correct reading the working directory string

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3761 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
LPFaint99 2009-07-12 07:17:43 +00:00
parent f6f6b870a9
commit f324d4b27d
1 changed files with 9 additions and 5 deletions

View File

@ -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