mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 15:31:39 +00:00
made unix Sys_mkdir() to print strerror in case of failure.
made windows Sys_mkdir() to use windows api functions. git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@507 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
2503c74cb6
commit
7ff46cf8d8
2 changed files with 45 additions and 40 deletions
|
@ -147,8 +147,13 @@ void Sys_Init (void)
|
|||
void Sys_mkdir (const char *path)
|
||||
{
|
||||
int rc = mkdir (path, 0777);
|
||||
if (rc != 0 && errno != EEXIST)
|
||||
Sys_Error("Unable to create directory %s", path);
|
||||
if (rc != 0 && errno == EEXIST)
|
||||
rc = 0;
|
||||
if (rc != 0)
|
||||
{
|
||||
rc = errno;
|
||||
Sys_Error("Unable to create directory %s: %s", path, strerror(rc));
|
||||
}
|
||||
}
|
||||
|
||||
static const char errortxt1[] = "\nERROR-OUT BEGIN\n\n";
|
||||
|
|
|
@ -196,8 +196,9 @@ void Sys_Init (void)
|
|||
|
||||
void Sys_mkdir (const char *path)
|
||||
{
|
||||
int rc = _mkdir (path);
|
||||
if (rc != 0 && errno != EEXIST)
|
||||
if (CreateDirectory(path, NULL) != 0)
|
||||
return;
|
||||
if (GetLastError() != ERROR_ALREADY_EXISTS)
|
||||
Sys_Error("Unable to create directory %s", path);
|
||||
}
|
||||
|
||||
|
@ -285,17 +286,17 @@ char *Sys_ConsoleInput (void)
|
|||
DWORD dummy, numread, numevents;
|
||||
|
||||
if (!isDedicated)
|
||||
return NULL; // no stdin necessary in graphical mode
|
||||
return NULL;
|
||||
|
||||
for ( ;; )
|
||||
{
|
||||
if (!GetNumberOfConsoleInputEvents (hinput, &numevents))
|
||||
if (GetNumberOfConsoleInputEvents(hinput, &numevents) == 0)
|
||||
Sys_Error ("Error getting # of console events");
|
||||
|
||||
if (numevents <= 0)
|
||||
break;
|
||||
|
||||
if (!ReadConsoleInput(hinput, recs, 1, &numread))
|
||||
if (ReadConsoleInput(hinput, recs, 1, &numread) == 0)
|
||||
Sys_Error ("Error reading console input");
|
||||
|
||||
if (numread != 1)
|
||||
|
@ -303,7 +304,7 @@ char *Sys_ConsoleInput (void)
|
|||
|
||||
if (recs[0].EventType == KEY_EVENT)
|
||||
{
|
||||
if (!recs[0].Event.KeyEvent.bKeyDown)
|
||||
if (recs[0].Event.KeyEvent.bKeyDown == FALSE)
|
||||
{
|
||||
ch = recs[0].Event.KeyEvent.uChar.AsciiChar;
|
||||
|
||||
|
@ -312,7 +313,7 @@ char *Sys_ConsoleInput (void)
|
|||
case '\r':
|
||||
WriteFile(houtput, "\r\n", 2, &dummy, NULL);
|
||||
|
||||
if (textlen)
|
||||
if (textlen != 0)
|
||||
{
|
||||
con_text[textlen] = 0;
|
||||
textlen = 0;
|
||||
|
@ -323,10 +324,9 @@ char *Sys_ConsoleInput (void)
|
|||
|
||||
case '\b':
|
||||
WriteFile(houtput, "\b \b", 3, &dummy, NULL);
|
||||
if (textlen)
|
||||
{
|
||||
if (textlen != 0)
|
||||
textlen--;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
Loading…
Reference in a new issue