diff options
| author | LPFaint99 <lpfaint99@gmail.com> | 2009-07-12 07:17:43 +0000 |
|---|---|---|
| committer | LPFaint99 <lpfaint99@gmail.com> | 2009-07-12 07:17:43 +0000 |
| commit | f324d4b27dce358b7824c445b2f2f3ac14f20dd2 (patch) | |
| tree | 82fcc2bb9b399689062c665ebd31ac9200e6b672 /Source/Core | |
| parent | f6f6b870a97ea32c5816f7738141388b018befb7 (diff) | |
correct reading the working directory string
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3761 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/DolphinWX/Src/Main.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp index 45fbdf8369..e86a21169d 100644 --- a/Source/Core/DolphinWX/Src/Main.cpp +++ b/Source/Core/DolphinWX/Src/Main.cpp @@ -164,15 +164,19 @@ bool DolphinApp::OnInit() } else { - char tmpChar[256]; - fread(tmpChar, 1, 255, workingDir); + char *tmpChar; + long len; + fseek(workingDir,0,SEEK_END); + len=ftell(workingDir); + fseek(workingDir,0,SEEK_SET); + tmpChar = new char[len]; + fread(tmpChar, len, 1, workingDir); fclose(workingDir); - wxSetWorkingDirectory(wxString::FromAscii(tmpChar)); - //PanicAlert("%s\n%s",tmpChar, (const char*)wxGetCwd().mb_str(/*wxConvUTF8*/)); - if (strcmp(tmpChar, wxGetCwd().mb_str()) != 0) + if (!wxSetWorkingDirectory(wxString::FromAscii(tmpChar))) { PanicAlert("set working directory failed"); } + delete [] tmpChar; } } #endif |
