- do not use POSIX directory functions in common code.

For Windows these need to redirect to Unicode system functions to properly handle paths not representable in 8 bit encodings.
This commit is contained in:
Christoph Oelckers 2022-08-17 09:55:47 +02:00
commit 8d3c1adf05
7 changed files with 76 additions and 22 deletions

View file

@ -53,6 +53,7 @@
#include "findfile.h"
#include "md5.h"
#include "i_specialpaths.h"
#include "i_system.h"
extern FILE* Logfile;
@ -178,12 +179,12 @@ UNSAFE_CCMD (crashout)
UNSAFE_CCMD (dir)
{
FString dir, path;
char curdir[256];
const char *match;
findstate_t c_file;
void *file;
if (!getcwd (curdir, countof(curdir)))
FString curdir = I_GetCWD();
if (curdir.IsEmpty())
{
Printf ("Current path too long\n");
return;
@ -192,7 +193,7 @@ UNSAFE_CCMD (dir)
if (argv.argc() > 1)
{
path = NicePath(argv[1]);
if (chdir(path))
if (!I_ChDir(path))
{
match = path;
dir = ExtractFilePath(path);
@ -208,7 +209,7 @@ UNSAFE_CCMD (dir)
{
match = "*";
}
if (chdir (dir))
if (!I_ChDir(dir))
{
Printf ("%s not found\n", dir.GetChars());
return;
@ -245,7 +246,7 @@ UNSAFE_CCMD (dir)
I_FindClose (file);
}
chdir (curdir);
I_ChDir(curdir);
}
//==========================================================================