Browse Source

fixed crash when logging folder is not specified

git-svn-id: svn://svn.code.sf.net/p/ditto-cp/code/trunk@521 595ec19a-5cb4-439b-94a8-42fb3063c22c
sabrogden 15 years ago
parent
commit
9c1a8d1785
2 changed files with 14 additions and 11 deletions
  1. 9 6
      Misc.cpp
  2. 5 5
      Options.cpp

+ 9 - 6
Misc.cpp

@@ -54,13 +54,16 @@ void AppendToFile(const TCHAR* fn, const TCHAR* msg)
 
 	ASSERT( file );
 
-#ifdef _UNICODE
-	fwprintf(file, msg);
-#else
-	fprintf(file, msg);
-#endif
+	if(file != NULL)
+	{
+		#ifdef _UNICODE
+			fwprintf(file, msg);
+		#else
+			fprintf(file, msg);
+		#endif
 
-	fclose(file);
+		fclose(file);	
+	}
 }
 
 void log(const TCHAR* msg, bool bFromSendRecieve, CString csFile, long lLine)

+ 5 - 5
Options.cpp

@@ -1667,7 +1667,7 @@ CString CGetSetOptions::GetPath(long lPathID)
 			csDir = GETENV(_T("U3_HOST_EXEC_PATH"));
 			FIX_CSTRING_PATH(csDir);
 		}
-		else
+		else if(CGetSetOptions::GetIsPortableDitto() == false)
 		{
 			csDir = GetAppDataPath();
 		}
@@ -1681,7 +1681,7 @@ CString CGetSetOptions::GetPath(long lPathID)
 			csDir = GETENV(_T("U3_HOST_EXEC_PATH"));
 			FIX_CSTRING_PATH(csDir);
 		}
-		else
+		else if(CGetSetOptions::GetIsPortableDitto() == false)
 		{
 			csDir = GetAppDataPath();
 		}
@@ -1725,12 +1725,12 @@ CString CGetSetOptions::GetPath(long lPathID)
 		}
 
 		csDir += "Addins\\";
-
-		//csDir = _T("C:\\Documents and Settings\\Brogdens\\Desktop\\ditto\\Addins\\OutlookExpress\\Debug\\");
-
+		
 		break;
 	}
 
+	CreateDirectory(csDir, NULL);
+
 	return csDir;
 }