appdata param

This commit is contained in:
p.kosyh 2011-03-29 11:37:11 +00:00
parent 19dac65262
commit 6eb745da4a
7 changed files with 33 additions and 10 deletions

1
debian/changelog vendored
View file

@ -5,6 +5,7 @@ instead (1.3.5) unstable; urgency=low
* bug fix in jump to pos logic; * bug fix in jump to pos logic;
* global dir is now readdir; * global dir is now readdir;
* multichannal sound system (add_sound, stop_sound); * multichannal sound system (add_sound, stop_sound);
* -appdata parameter;
* show dir to be deleted while remove game; * show dir to be deleted while remove game;
-- Peter Kosyh <p.kosyh@gmail.com> Tue, 29 Mar 2011 14:08:00 +0300 -- Peter Kosyh <p.kosyh@gmail.com> Tue, 29 Mar 2011 14:08:00 +0300

View file

@ -10,6 +10,8 @@
#define KBD_INVERSE 2 #define KBD_INVERSE 2
#define KBD_MAX 3 #define KBD_MAX 3
extern char *appdata_sw;
extern int opt_fsize; extern int opt_fsize;
extern int opt_fs; extern int opt_fs;
extern int opt_owntheme; extern int opt_owntheme;

View file

@ -29,6 +29,7 @@ char *themes_sw = NULL;
char *encode_sw = NULL; char *encode_sw = NULL;
char *encode_output = NULL; char *encode_output = NULL;
char *mode_sw = NULL; char *mode_sw = NULL;
char *appdata_sw = NULL;
#ifdef _USE_UNPACK #ifdef _USE_UNPACK
extern int unpack(const char *zipfilename, const char *where); extern int unpack(const char *zipfilename, const char *where);
@ -152,8 +153,11 @@ int main(int argc, char *argv[])
theme_sw = ""; theme_sw = "";
} else if (!strcmp(argv[i], "-nostdgames")) { } else if (!strcmp(argv[i], "-nostdgames")) {
nostdgames_sw = 1; nostdgames_sw = 1;
} else if (!strcmp(argv[i], "-nostdthemes")) { } else if (!strcmp(argv[i], "-appdata")) {
nostdthemes_sw = 1; if ((i + 1) < argc)
appdata_sw = argv[++i];
else
appdata_sw = "";
} else if (!strcmp(argv[i], "-gamespath")) { } else if (!strcmp(argv[i], "-gamespath")) {
if ((i + 1) < argc) if ((i + 1) < argc)
games_sw = argv[++i]; games_sw = argv[++i];

View file

@ -71,8 +71,12 @@ char *open_file_dialog(void)
char *appdir(void) char *appdir(void)
{ {
static char dir[PATH_MAX]; static char dir[PATH_MAX];
strcpy(dir, game_cwd); if (appdata_sw)
strcat(dir, "/appdata"); strcpy(dir, appdata_sw);
else {
strcpy(dir, game_cwd);
strcat(dir, "/appdata");
}
return dir; return dir;
} }

View file

@ -187,8 +187,12 @@ char *appdir(void)
static char dir[PATH_MAX]; static char dir[PATH_MAX];
struct passwd *pw; struct passwd *pw;
#ifdef _LOCAL_APPDATA #ifdef _LOCAL_APPDATA
strcpy(dir, game_cwd); if (appdata_sw)
strcat(dir, "/appdata"); strcpy(dir, appdata_sw);
else {
strcpy(dir, game_cwd);
strcat(dir, "/appdata");
}
if (!access(dir, W_OK)) if (!access(dir, W_OK))
return dir; return dir;
#endif #endif

View file

@ -160,8 +160,12 @@ char *home_dir( void )
char *app_dir( void ) char *app_dir( void )
{ {
static char appdir[PATH_MAX]=""; static char appdir[PATH_MAX]="";
strcpy(appdir, game_cwd); if (appdata_sw)
strcat(appdir, "/appdata"); strcpy(appdir, appdata_sw);
else {
strcpy(appdir, game_cwd);
strcat(appdir, "/appdata");
}
if (!access(appdir, W_OK)) if (!access(appdir, W_OK))
return appdir; return appdir;
} }

View file

@ -155,8 +155,12 @@ char *app_dir( void )
{ {
static char appdir[PATH_MAX]=""; static char appdir[PATH_MAX]="";
#ifdef _LOCAL_APPDATA #ifdef _LOCAL_APPDATA
strcpy(appdir, game_cwd); if (appdata_sw)
strcat(appdir, "/appdata"); strcpy(appdir, appdata_sw);
else {
strcpy(appdir, game_cwd);
strcat(appdir, "/appdata");
}
if (!access(appdir, W_OK)) if (!access(appdir, W_OK))
return appdir; return appdir;
#endif #endif