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;
* global dir is now readdir;
* multichannal sound system (add_sound, stop_sound);
* -appdata parameter;
* show dir to be deleted while remove game;
-- 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_MAX 3
extern char *appdata_sw;
extern int opt_fsize;
extern int opt_fs;
extern int opt_owntheme;

View file

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

View file

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

View file

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

View file

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

View file

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