Update gtk108

This commit is contained in:
daleclack 2021-09-23 14:09:32 +08:00
parent 22074d37a4
commit 694a58fda7
2 changed files with 19 additions and 1 deletions

View File

@ -1,8 +1,20 @@
#include "MyWin.hh"
#define bin_str 6
int main(int argc,char **argv){
//Get binary dir
const char * src = *argv;
int len = strlen(src); //argv[0]
char * tmp = (char*)malloc(len);
#ifdef _WIN32
strncpy(tmp,src,len-bin_str-4);
tmp[len-bin_str-4]='\0';
#else
strncpy(tmp,src,len-bin_str);
tmp[len-bin_str]='\0';
#endif
//Initalize env
Glib::setenv("GSETTINGS_SCHEMA_DIR",".",false);
Glib::setenv("GSETTINGS_SCHEMA_DIR",tmp,false);
//Create a application and run
auto app=Gtk::Application::create(argc,argv,"org.gtk.daleclack");

View File

@ -6,7 +6,13 @@ int main(int argc,char **argv){
const char * src = *argv;
int len = strlen(src); //argv[0]
char * tmp = malloc(len);
#ifdef _WIN32
strncpy(tmp,src,len-8);
tmp[len-8]='\0';
#else
strncpy(tmp,src,len-4);
tmp[len-4]='\0';
#endif
printf("%s\n",tmp);
free(tmp);
return 0;