From 6eb745da4a21b9759fb1b93789d098ce2a64d611 Mon Sep 17 00:00:00 2001
From: "p.kosyh"
Date: Tue, 29 Mar 2011 11:37:11 +0000
Subject: [PATCH] appdata param
---
debian/changelog | 1 +
src/sdl-instead/config.h | 2 ++
src/sdl-instead/main.c | 8 ++++++--
src/sdl-instead/s60.c | 8 ++++++--
src/sdl-instead/unix.c | 8 ++++++--
src/sdl-instead/wince.c | 8 ++++++--
src/sdl-instead/windows.c | 8 ++++++--
7 files changed, 33 insertions(+), 10 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index ac8b76c..c174c7e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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 Tue, 29 Mar 2011 14:08:00 +0300
diff --git a/src/sdl-instead/config.h b/src/sdl-instead/config.h
index df1f743..8a7334e 100644
--- a/src/sdl-instead/config.h
+++ b/src/sdl-instead/config.h
@@ -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;
diff --git a/src/sdl-instead/main.c b/src/sdl-instead/main.c
index 9675c9a..178d1f6 100644
--- a/src/sdl-instead/main.c
+++ b/src/sdl-instead/main.c
@@ -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];
diff --git a/src/sdl-instead/s60.c b/src/sdl-instead/s60.c
index b787592..9af1cbf 100644
--- a/src/sdl-instead/s60.c
+++ b/src/sdl-instead/s60.c
@@ -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;
}
diff --git a/src/sdl-instead/unix.c b/src/sdl-instead/unix.c
index e0fc3c5..ceede94 100644
--- a/src/sdl-instead/unix.c
+++ b/src/sdl-instead/unix.c
@@ -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
diff --git a/src/sdl-instead/wince.c b/src/sdl-instead/wince.c
index 3fd0916..a2b818e 100644
--- a/src/sdl-instead/wince.c
+++ b/src/sdl-instead/wince.c
@@ -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;
}
diff --git a/src/sdl-instead/windows.c b/src/sdl-instead/windows.c
index bccde7e..390ba0e 100644
--- a/src/sdl-instead/windows.c
+++ b/src/sdl-instead/windows.c
@@ -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