]> granicus.if.org Git - transmission/commitdiff
(libT) fix bug in getting win32 home directory
authorCharles Kerr <charles@transmissionbt.com>
Sun, 2 Nov 2008 15:58:30 +0000 (15:58 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Sun, 2 Nov 2008 15:58:30 +0000 (15:58 +0000)
libtransmission/platform.c

index 751a7408306501416ef4026b2d36531d687e8192..70c9372210d2f84d85d19c0d29ef65b194303519 100644 (file)
@@ -270,7 +270,10 @@ getHomeDir( void )
         if( !home )
         {
 #ifdef WIN32
-            SHGetFolderPath( NULL, CSIDL_MYDOCUMENTS, NULL, 0, home );
+            char appdata[MAX_PATH]; /* SHGetFolderPath() requires MAX_PATH */
+            *appdata = '\0';
+            SHGetFolderPath( NULL, CSIDL_MYDOCUMENTS, NULL, 0, appdata );
+            home = tr_strdup( appdata );
 #elif defined( __BEOS__ ) || defined( __AMIGAOS4__ )
             home = tr_strdup( "" );
 #else
@@ -308,7 +311,7 @@ getOldConfigDir( void )
 #elif defined( __AMIGAOS4__ )
         path = tr_strdup( "PROGDIR:.transmission" );
 #elif defined( WIN32 )
-        char appdata[MAX_PATH_LENGTH];
+        char appdata[MAX_PATH]; /* SHGetFolderPath() requires MAX_PATH */
         SHGetFolderPath( NULL, CSIDL_APPDATA, NULL, 0, appdata );
         path = tr_buildPath( appdata, "Transmission", NULL );
 #else