mirror of https://github.com/snes9xgit/snes9x.git
win32: do not change current directory in S9xGetDirectory
This commit is contained in:
parent
243ab97806
commit
b9b2f84315
|
@ -210,6 +210,7 @@
|
||||||
#include "AVIOutput.h"
|
#include "AVIOutput.h"
|
||||||
#include "wlanguage.h"
|
#include "wlanguage.h"
|
||||||
|
|
||||||
|
#include <shlwapi.h>
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
|
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
@ -300,6 +301,7 @@ static bool startDirectoryValid = false;
|
||||||
|
|
||||||
const TCHAR *S9xGetDirectoryT (enum s9x_getdirtype dirtype)
|
const TCHAR *S9xGetDirectoryT (enum s9x_getdirtype dirtype)
|
||||||
{
|
{
|
||||||
|
static TCHAR filename[PATH_MAX];
|
||||||
if(!startDirectoryValid)
|
if(!startDirectoryValid)
|
||||||
{
|
{
|
||||||
// directory of the executable's location:
|
// directory of the executable's location:
|
||||||
|
@ -314,8 +316,6 @@ const TCHAR *S9xGetDirectoryT (enum s9x_getdirtype dirtype)
|
||||||
startDirectoryValid = true;
|
startDirectoryValid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetCurrentDirectory(startDirectory); // makes sure relative paths are relative to the application's location
|
|
||||||
|
|
||||||
const TCHAR* rv = startDirectory;
|
const TCHAR* rv = startDirectory;
|
||||||
|
|
||||||
switch(dirtype){
|
switch(dirtype){
|
||||||
|
@ -358,7 +358,6 @@ const TCHAR *S9xGetDirectoryT (enum s9x_getdirtype dirtype)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ROMFILENAME_DIR: {
|
case ROMFILENAME_DIR: {
|
||||||
static TCHAR filename [PATH_MAX];
|
|
||||||
lstrcpy(filename, _tFromChar(Memory.ROMFilename));
|
lstrcpy(filename, _tFromChar(Memory.ROMFilename));
|
||||||
if(!filename[0])
|
if(!filename[0])
|
||||||
rv = GUI.RomDir;
|
rv = GUI.RomDir;
|
||||||
|
@ -373,6 +372,13 @@ const TCHAR *S9xGetDirectoryT (enum s9x_getdirtype dirtype)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (PathIsRelative(rv)) {
|
||||||
|
TCHAR temp_container[PATH_MAX];
|
||||||
|
_sntprintf(temp_container, PATH_MAX, TEXT("%s\\%s"), startDirectory, rv);
|
||||||
|
GetFullPathName(temp_container, PATH_MAX, filename, NULL);
|
||||||
|
rv = temp_container;
|
||||||
|
}
|
||||||
|
|
||||||
_tmkdir(rv);
|
_tmkdir(rv);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
|
Loading…
Reference in New Issue