Author: tom
Date: Tue Nov 11 08:50:58 2008
New Revision: 3326
URL: http://svn.slimdevices.com?rev=3326&root=Jive&view=rev
Log:
Userdir changes for windows, use more reliable home dir env var, create dir if
doesn't exists prior to console redirection
Modified:
7.3/trunk/squeezeplay/src/squeezeplay/src/common.h
7.3/trunk/squeezeplay/src/squeezeplay/src/jive.c
Modified: 7.3/trunk/squeezeplay/src/squeezeplay/src/common.h
URL:
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/src/common.h?rev=3326&root=Jive&r1=3325&r2=3326&view=diff
==============================================================================
--- 7.3/trunk/squeezeplay/src/squeezeplay/src/common.h (original)
+++ 7.3/trunk/squeezeplay/src/squeezeplay/src/common.h Tue Nov 11 08:50:58 2008
@@ -72,6 +72,7 @@
#define PATH_SEPARATOR_CHAR ';'
#define PATH_SEPARATOR_STR ";"
#define LIBRARY_EXT "dll"
+#define mkdir(path,mode) _mkdir (path)
typedef _W64 int ssize_t;
#endif /* WIN32 */
Modified: 7.3/trunk/squeezeplay/src/squeezeplay/src/jive.c
URL:
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/src/jive.c?rev=3326&root=Jive&r1=3325&r2=3326&view=diff
==============================================================================
--- 7.3/trunk/squeezeplay/src/squeezeplay/src/jive.c (original)
+++ 7.3/trunk/squeezeplay/src/squeezeplay/src/jive.c Tue Nov 11 08:50:58 2008
@@ -93,11 +93,11 @@
if (home != NULL) {
strcpy(userdir, home);
} else{
- const char *homepath = getenv("HOMEPATH");
+ const char *homepath = getenv("USERPROFILE");
if (homepath != NULL) {
strcpy(userdir, homepath);
} else {
- l_message("Error", "No user home directory found,
looking for HOME and HOMEPATH env vars...");
+ l_message("Error", "No user home directory found,
looking for HOME and USERPROFILE env vars...");
exit(-1);
}
}
@@ -517,8 +517,13 @@
}
static void redirect_stdio() {
- char *stdoutpath, *stderrpath;
-
+ char *userdir, *stdoutpath, *stderrpath;
+
+ userdir = malloc(PATH_MAX+1);
+ if (!userdir) {
+ l_message("Error", "malloc failure for userdir");
+ exit(-1);
+ }
stdoutpath = malloc(PATH_MAX+1);
if (!stdoutpath) {
l_message("Error", "malloc failure for stdoutpath");
@@ -529,12 +534,16 @@
l_message("Error", "stderrpath failure for binpath");
exit(-1);
}
+ get_user_dir(userdir);
+ mkdir(userdir, 755);
+
get_stdout_file_path(stdoutpath);
get_stderr_file_path(stderrpath);
freopen(stdoutpath, TEXT("w"), stdout);
freopen(stderrpath, TEXT("w"), stderr);
+ free(userdir);
free(stdoutpath);
free(stderrpath);
}
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins