Author: tom
Date: Thu Nov 6 15:01:44 2008
New Revision: 3305
URL: http://svn.slimdevices.com?rev=3305&root=Jive&view=rev
Log:
Bug 9665:
Description:
stdout.txt and stderr.txt now go to user dir instead of app dir (needed ofr
Vista)
Modified:
7.3/trunk/squeezeplay/src/Jive.sln
7.3/trunk/squeezeplay/src/squeezeplay/VisualC/jive.vcproj
7.3/trunk/squeezeplay/src/squeezeplay/src/jive.c
Modified: 7.3/trunk/squeezeplay/src/Jive.sln
URL:
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/Jive.sln?rev=3305&root=Jive&r1=3304&r2=3305&view=diff
==============================================================================
--- 7.3/trunk/squeezeplay/src/Jive.sln (original)
+++ 7.3/trunk/squeezeplay/src/Jive.sln Thu Nov 6 15:01:44 2008
@@ -1675,8 +1675,8 @@
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|Any
CPU.ActiveCfg = Release|Win32
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|Mixed
Platforms.ActiveCfg = Release|Win32
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|Mixed
Platforms.Build.0 = Release|Win32
- {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|Win32.ActiveCfg
= Release|Win32
- {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|Win32.Build.0 =
Release|Win32
+ {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|Win32.ActiveCfg
= Release_NoSTDIO|Win32
+ {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|Win32.Build.0 =
Release_NoSTDIO|Win32
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|x64.ActiveCfg =
Release|Win32
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.withLua50_Debug|Any
CPU.ActiveCfg = Debug|Win32
{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.withLua50_Debug|Mixed
Platforms.ActiveCfg = Debug|Win32
Modified: 7.3/trunk/squeezeplay/src/squeezeplay/VisualC/jive.vcproj
URL:
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/VisualC/jive.vcproj?rev=3305&root=Jive&r1=3304&r2=3305&view=diff
==============================================================================
--- 7.3/trunk/squeezeplay/src/squeezeplay/VisualC/jive.vcproj (original)
+++ 7.3/trunk/squeezeplay/src/squeezeplay/VisualC/jive.vcproj Thu Nov 6
15:01:44 2008
@@ -119,7 +119,7 @@
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".;..\src;..\src\jiveui;"..\..\SDL-1.2.13\include";"..\..\SDL-1.2.13\VisualC\include";"..\..\SDL_image-1.2.5";"..\..\SDL_ttf-2.0.8";"..\..\SDL_gfx-2.0.15";"..\..\lua-5.1.1\src";"..\..\tolua++-1.0.92\include";..\..\portaudio_v19_1360\include;"..\..\flac-1.2.1\include";"..\..\libmad-0.15.1b";..\..\"
-
PreprocessorDefinitions="WIN32;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
+
PreprocessorDefinitions="WIN32;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;NO_STDIO_REDIRECT"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
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=3305&root=Jive&r1=3304&r2=3305&view=diff
==============================================================================
--- 7.3/trunk/squeezeplay/src/squeezeplay/src/jive.c (original)
+++ 7.3/trunk/squeezeplay/src/squeezeplay/src/jive.c Thu Nov 6 15:01:44 2008
@@ -88,6 +88,24 @@
/* Code below is specific to jive */
/******************************************************************************/
+static void get_user_dir(char *userdir) {
+ const char *home = getenv("HOME");
+ if (home != NULL) {
+ strcpy(userdir, home);
+ } else{
+ const char *homepath = getenv("HOMEPATH");
+ if (homepath != NULL) {
+ strcpy(userdir, homepath);
+ } else {
+ l_message("Error", "No user home directory found,
looking for HOME and HOMEPATH env vars...");
+ exit(-1);
+ }
+ }
+ strcat(userdir, "/.squeezeplay");
+
+}
+
+
/* openlibs
** open the libraries we want to use
*/
@@ -168,7 +186,6 @@
*/
static void paths_setup(lua_State *L, char *app) {
char *temp, *binpath, *path, *userpath;
- const char *home;
DEBUG_TRACE("Setting up paths");
@@ -212,20 +229,8 @@
DEBUG_TRACE("* Jive binary directory: %s", binpath);
- home = getenv("HOME");
- if (home != NULL) {
- strcpy(userpath, home);
- } else{
- const char *homepath = getenv("HOMEPATH");
- if (homepath != NULL) {
- strcpy(userpath, homepath);
- } else {
- l_message("Error", "No user home directory found,
looking for HOME and HOMEPATH env vars...");
- exit(-1);
- }
- }
-
- strcat(userpath, "/.squeezeplay/userpath");
+ get_user_dir(userpath);
+ strcat(userpath, "/userpath");
// set paths in lua (package.path & package cpath)
lua_getglobal(L, "package");
@@ -500,6 +505,41 @@
};
+#ifdef NO_STDIO_REDIRECT
+static void get_stdout_file_path(char *path) {
+ get_user_dir(path);
+ strcat(path, "/stdout.txt");
+}
+
+static void get_stderr_file_path(char *path) {
+ get_user_dir(path);
+ strcat(path, "/stderr.txt");
+}
+
+static void redirect_stdio() {
+ char *stdoutpath, *stderrpath;
+
+ stdoutpath = malloc(PATH_MAX+1);
+ if (!stdoutpath) {
+ l_message("Error", "malloc failure for stdoutpath");
+ exit(-1);
+ }
+ stderrpath = malloc(PATH_MAX+1);
+ if (!stderrpath) {
+ l_message("Error", "stderrpath failure for binpath");
+ exit(-1);
+ }
+ get_stdout_file_path(stdoutpath);
+ get_stderr_file_path(stderrpath);
+
+ freopen(stdoutpath, TEXT("w"), stdout);
+ freopen(stderrpath, TEXT("w"), stderr);
+
+ free(stdoutpath);
+ free(stderrpath);
+}
+#endif
+
/* pmain
** our main, called in lua protected mode by main
*/
@@ -524,6 +564,11 @@
// setup our paths
paths_setup(L, argv[0]);
+
+#ifdef NO_STDIO_REDIRECT
+ /* SDL not redirecting. Instead, put console output in user writable
directory - used for Vista, for instance which disallows writing to app dir */
+ redirect_stdio();
+#endif
// do we have an argument?
if (argv[1] != NULL) {
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins