Commit 6c1b4ecf authored by lcgamboa's avatar lcgamboa

fix: Fix support to multi byte char in command line file name

parent dec4aa2f
...@@ -2,5 +2,5 @@ PACKAGE=picsimlab ...@@ -2,5 +2,5 @@ PACKAGE=picsimlab
MAINVER=0 MAINVER=0
MINORVER=9 MINORVER=9
VERSION=0.9.2 VERSION=0.9.2
DATE=240224 DATE=240302
VERSION_STABLE=0.9.1 VERSION_STABLE=0.9.1
...@@ -9,7 +9,7 @@ cl sudo apt-get -y upgrade ...@@ -9,7 +9,7 @@ cl sudo apt-get -y upgrade
cl sudo apt-get -y install flatpak flatpak-builder bzip2 cl sudo apt-get -y install flatpak flatpak-builder bzip2
flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak --user install flathub org.freedesktop.Platform//21.08 org.freedesktop.Sdk//21.08 -y flatpak --user install flathub org.freedesktop.Platform//22.08 org.freedesktop.Sdk//22.08 -y
#VERSION="${VERSION_STABLE}" #VERSION="${VERSION_STABLE}"
VERSION="${VERSION}_${DATE}" VERSION="${VERSION}_${DATE}"
......
app-id: com.github.lcgamboa.picsimlab app-id: com.github.lcgamboa.picsimlab
runtime: org.freedesktop.Platform runtime: org.freedesktop.Platform
runtime-version: '21.08' runtime-version: '22.08'
sdk: org.freedesktop.Sdk sdk: org.freedesktop.Sdk
command: picsimlab command: picsimlab
rename-desktop-file: picsimlab.desktop rename-desktop-file: picsimlab.desktop
......
...@@ -442,7 +442,7 @@ void lcd_data(lcd_t* lcd, char data) { ...@@ -442,7 +442,7 @@ void lcd_data(lcd_t* lcd, char data) {
} }
unsigned char lcd_read_busyf_acounter(lcd_t* lcd) { unsigned char lcd_read_busyf_acounter(lcd_t* lcd) {
// busy flag aways 0 // busy flag always 0
unsigned char status = (0x7F & lcd->addr_counter); unsigned char status = (0x7F & lcd->addr_counter);
// switch betwwen 8 or 4 bits communication // switch betwwen 8 or 4 bits communication
......
...@@ -327,7 +327,7 @@ bool CSpareParts::LoadPinAlias(std::string fname, unsigned char show_error_msg) ...@@ -327,7 +327,7 @@ bool CSpareParts::LoadPinAlias(std::string fname, unsigned char show_error_msg)
bool CSpareParts::LoadConfig(std::string fname, const int disable_debug) { bool CSpareParts::LoadConfig(std::string fname, const int disable_debug) {
char name[256]; char name[256];
char temp[4096]; char temp[4096];
unsigned int x, y; int x, y;
int orient; int orient;
std::vector<std::string> prefs; std::vector<std::string> prefs;
int newformat = 0; int newformat = 0;
......
...@@ -792,7 +792,11 @@ void CPWindow1::_EvOnCreate(CControl* control) { ...@@ -792,7 +792,11 @@ void CPWindow1::_EvOnCreate(CControl* control) {
printf("PICSimLab: Command Line: "); printf("PICSimLab: Command Line: ");
for (int i = 0; i < Application->Aargc; i++) { for (int i = 0; i < Application->Aargc; i++) {
#ifdef wxUSE_UNICODE
printf("%s ", (const char*)lxString(Application->Aargvw[i]).utf8_str());
#else
printf("%s ", Application->Aargv[i]); printf("%s ", Application->Aargv[i]);
#endif
} }
printf("\n"); printf("\n");
...@@ -808,35 +812,47 @@ void CPWindow1::_EvOnCreate(CControl* control) { ...@@ -808,35 +812,47 @@ void CPWindow1::_EvOnCreate(CControl* control) {
std::string(fname_error) + std::string(fname_error) +
"\n If the problem persists, please consider opening an issue on github.\n "); "\n If the problem persists, please consider opening an issue on github.\n ");
} else if (Application->Aargc == 2) { // only .pzw file } else if (Application->Aargc == 2) { // only .pzw file
#ifdef wxUSE_UNICODE
fn.Assign(Application->Aargvw[1]);
#else
fn.Assign(Application->Aargv[1]); fn.Assign(Application->Aargv[1]);
#endif
fn.MakeAbsolute(); fn.MakeAbsolute();
// load options // load options
PICSimLab.Configure(home, 1, 1); PICSimLab.Configure(home, 1, 1);
// check if it is a demonstration // check if it is a demonstration
std::string fns = (const char*)fn.GetFullPath().c_str(); std::string fns = (const char*)fn.GetFullPath().utf8_str();
lxFileName fn_dir; lxFileName fn_dir;
fn_dir.Assign(PICSimLab.GetSharePath() + "boards/"); fn_dir.Assign(PICSimLab.GetSharePath() + "boards/");
fn_dir.MakeAbsolute(); fn_dir.MakeAbsolute();
if ((fns.find(fn_dir.GetFullPath()) != std::string::npos) && (fns.find("demo.pzw") != std::string::npos)) { if ((fns.find(fn_dir.GetFullPath()) != std::string::npos) && (fns.find("demo.pzw") != std::string::npos)) {
PICSimLab.LoadWorkspace((const char*)fn.GetFullPath().c_str(), 0); PICSimLab.LoadWorkspace((const char*)fn.GetFullPath().utf8_str(), 0);
PICSimLab.SetWorkspaceFileName(""); PICSimLab.SetWorkspaceFileName("");
} else { } else {
PICSimLab.LoadWorkspace((const char*)fn.GetFullPath().c_str()); PICSimLab.LoadWorkspace((const char*)fn.GetFullPath().utf8_str());
} }
} else if ((Application->Aargc >= 3) && (Application->Aargc <= 5)) { } else if ((Application->Aargc >= 3) && (Application->Aargc <= 5)) {
// arguments: Board Processor File.hex(.bin) file.pcf // arguments: Board Processor File.hex(.bin) file.pcf
if (Application->Aargc >= 4) { if (Application->Aargc >= 4) {
#ifdef wxUSE_UNICODE
fn.Assign(Application->Aargvw[3]);
#else
fn.Assign(Application->Aargv[3]); fn.Assign(Application->Aargv[3]);
#endif
fn.MakeAbsolute(); fn.MakeAbsolute();
} }
if (Application->Aargc == 5) { if (Application->Aargc == 5) {
#ifdef wxUSE_UNICODE
fn_spare.Assign(Application->Aargvw[4]);
#else
fn_spare.Assign(Application->Aargv[4]); fn_spare.Assign(Application->Aargv[4]);
#endif
fn_spare.MakeAbsolute(); fn_spare.MakeAbsolute();
} }
...@@ -870,9 +886,9 @@ void CPWindow1::_EvOnCreate(CControl* control) { ...@@ -870,9 +886,9 @@ void CPWindow1::_EvOnCreate(CControl* control) {
// search for file name // search for file name
if (Application->Aargc >= 4) { if (Application->Aargc >= 4) {
// load options // load options
PICSimLab.Configure(home, 0, 1, (const char*)fn.GetFullPath().c_str()); PICSimLab.Configure(home, 0, 1, (const char*)fn.GetFullPath().utf8_str());
if (Application->Aargc == 5) { if (Application->Aargc == 5) {
SpareParts.LoadConfig((const char*)fn_spare.GetFullPath().c_str()); SpareParts.LoadConfig((const char*)fn_spare.GetFullPath().utf8_str());
} }
} else { } else {
// load options // load options
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment