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
MAINVER=0
MINORVER=9
VERSION=0.9.2
DATE=240224
DATE=240302
VERSION_STABLE=0.9.1
......@@ -9,7 +9,7 @@ cl sudo apt-get -y upgrade
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 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}_${DATE}"
......
app-id: com.github.lcgamboa.picsimlab
runtime: org.freedesktop.Platform
runtime-version: '21.08'
runtime-version: '22.08'
sdk: org.freedesktop.Sdk
command: picsimlab
rename-desktop-file: picsimlab.desktop
......
......@@ -442,7 +442,7 @@ void lcd_data(lcd_t* lcd, char data) {
}
unsigned char lcd_read_busyf_acounter(lcd_t* lcd) {
// busy flag aways 0
// busy flag always 0
unsigned char status = (0x7F & lcd->addr_counter);
// switch betwwen 8 or 4 bits communication
......
......@@ -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) {
char name[256];
char temp[4096];
unsigned int x, y;
int x, y;
int orient;
std::vector<std::string> prefs;
int newformat = 0;
......
......@@ -792,7 +792,11 @@ void CPWindow1::_EvOnCreate(CControl* control) {
printf("PICSimLab: Command Line: ");
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]);
#endif
}
printf("\n");
......@@ -808,35 +812,47 @@ void CPWindow1::_EvOnCreate(CControl* control) {
std::string(fname_error) +
"\n If the problem persists, please consider opening an issue on github.\n ");
} else if (Application->Aargc == 2) { // only .pzw file
#ifdef wxUSE_UNICODE
fn.Assign(Application->Aargvw[1]);
#else
fn.Assign(Application->Aargv[1]);
#endif
fn.MakeAbsolute();
// load options
PICSimLab.Configure(home, 1, 1);
// 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;
fn_dir.Assign(PICSimLab.GetSharePath() + "boards/");
fn_dir.MakeAbsolute();
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("");
} 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)) {
// arguments: Board Processor File.hex(.bin) file.pcf
if (Application->Aargc >= 4) {
#ifdef wxUSE_UNICODE
fn.Assign(Application->Aargvw[3]);
#else
fn.Assign(Application->Aargv[3]);
#endif
fn.MakeAbsolute();
}
if (Application->Aargc == 5) {
#ifdef wxUSE_UNICODE
fn_spare.Assign(Application->Aargvw[4]);
#else
fn_spare.Assign(Application->Aargv[4]);
#endif
fn_spare.MakeAbsolute();
}
......@@ -870,9 +886,9 @@ void CPWindow1::_EvOnCreate(CControl* control) {
// search for file name
if (Application->Aargc >= 4) {
// 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) {
SpareParts.LoadConfig((const char*)fn_spare.GetFullPath().c_str());
SpareParts.LoadConfig((const char*)fn_spare.GetFullPath().utf8_str());
}
} else {
// 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