+#define _Noreturn
+
#undef __BLOCKS__
+
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
void * __ecereNameSpace__ecere__com__eSystem_New0(unsigned int size);
void * __ecereNameSpace__ecere__com__eSystem_Renew(void * memory, unsigned int size);
void * __ecereNameSpace__ecere__com__eSystem_Renew0(void * memory, unsigned int size);
-unsigned short * __ecereNameSpace__ecere__sys__UTF8toUTF16(char * source, int * wordCount);
-unsigned short * __ecereNameSpace__ecere__sys__UTF8toUTF16Buffer(char * source, uint16 * dest, int max);
-char * __ecereNameSpace__ecere__sys__UTF16toUTF8(uint16 * source);
+unsigned short * __ecereNameSpace__ecere__sys__UTF8toUTF16(const char * source, int * wordCount);
+unsigned short * __ecereNameSpace__ecere__sys__UTF8toUTF16Buffer(const char * source, uint16 * dest, int max);
+char * __ecereNameSpace__ecere__sys__UTF16toUTF8(const uint16 * source);
+void __ecereNameSpace__ecere__sys__ChangeCh(char * string, char ch1, char ch2);
#if defined(__WIN32__) || defined(__WATCOMC__)
#include <direct.h>
-BOOL WINAPI GetVolumePathName(LPCTSTR lpszFileName,LPTSTR lpszVolumePathName,DWORD cchBufferLength);
+__declspec(dllimport) BOOL WINAPI GetVolumePathName(LPCTSTR lpszFileName,LPTSTR lpszVolumePathName,DWORD cchBufferLength);
#else
#include <dirent.h>
#endif
SecSince1970 created;
} FileStats;
-char * __ecereNameSpace__ecere__sys__GetLastDirectory(char * string, char * output);
-bool __ecereNameSpace__ecere__sys__SplitArchivePath(char * fileName, char * archiveName, char ** archiveFile);
+char * __ecereNameSpace__ecere__sys__GetLastDirectory(const char * string, char * output);
+bool __ecereNameSpace__ecere__sys__SplitArchivePath(const char * fileName, char * archiveName, char ** archiveFile);
#if defined(__WIN32__) && !defined(ECERE_BOOTSTRAP)
-void __ecereMethod___ecereNameSpace__ecere__sys__EARFileSystem_FixCase(char * archive, char * name);
+void __ecereMethod___ecereNameSpace__ecere__sys__EARFileSystem_FixCase(const char * archive, char * name);
static BOOL CALLBACK EnumThreadWindowsProc(HWND hwnd, LPARAM lParam)
{
DWORD pid;
if(IsWindowVisible(hwnd) && GetWindowThreadProcessId(hwnd, &pid) && pid == GetCurrentProcessId())
- {
+ {
*(void **)lParam = hwnd;
return FALSE;
}
- return TRUE;
+ return TRUE;
}
bool WinReviveNetworkResource(uint16 * _wfileName)
{
if(!windowHandle)
{
EnumWindows(EnumThreadWindowsProc, (LPARAM)&windowHandle);
-
+
}
if(WNetAddConnection3(windowHandle, &nr, null, null, CONNECT_INTERACTIVE|CONNECT_PROMPT) == NO_ERROR)
result = true;
(uint)(length ? ((length & 0xFFFFFFFF00000000LL) >> 32) : 0xFFFFFFFF),
&overlapped) != 0;
else
- return LockFileEx(hFile, ((type == exclusive) ? LOCKFILE_EXCLUSIVE_LOCK : 0) | (wait ? 0 : LOCKFILE_FAIL_IMMEDIATELY), 0,
+ return LockFileEx(hFile, ((type == exclusive) ? LOCKFILE_EXCLUSIVE_LOCK : 0) | (wait ? 0 : LOCKFILE_FAIL_IMMEDIATELY), 0,
(uint)(length ? (length & 0xFFFFFFFF) : 0xFFFFFFFF),
(uint)(length ? ((length & 0xFFFFFFFF00000000LL) >> 32) : 0xFFFFFFFF),
&overlapped) != 0;
fd = fileno(output ? output : input);
return fcntl(fd, wait ? F_SETLKW : F_SETLK, &fl) != -1;
-#endif
+#endif
}
}
#endif
}
-FileAttribs FILE_FileExists(char * fileName)
+FileAttribs FILE_FileExists(const char * fileName)
{
#ifdef __WIN32__
FileAttribs result = 0;
{
if(returnCode == WN_SUCCESS)
{
- if(!wcscmpi(buffer->lpRemoteName, _wfileName))
+ if(!_wcsicmp(buffer->lpRemoteName, _wfileName))
result = (FileAttribs)( isDirectory | isServer );
}
break;
#endif
}
-bool FILE_FileGetSize(char * fileName, FileSize * size)
+bool FILE_FileGetSize(const char * fileName, FileSize * size)
{
bool result = false;
#if defined(__WIN32__)
return result;
}
-bool FILE_FileGetStats(char * fileName, FileStats * stats)
+bool FILE_FileGetStats(const char * fileName, FileStats * stats)
{
bool result = false;
#if defined(__WIN32__)
stats->accessed = Win32FileTimeToTimeStamp(&a);
stats->modified = Win32FileTimeToTimeStamp(&m);
#endif
-
+
CloseHandle(hFile);
}
}
#else
stats->accessed = s.st_atime;
- stats->created = s.st_ctime;
+ // UNIX st_ctime is 'status change' time, not creation time
+ // Marking created as 0, as ctime changes cause unreproducible builds
+ stats->created = 0;
stats->modified = s.st_mtime;
#endif
/*
char fileName[MAX_LOCATION];
strcpy(fileName, name);
__ecereMethod___ecereNameSpace__ecere__sys__EARFileSystem_FixCase(archive, fileName);
- FILE_FileFixCase(archive);
+ if(archive[0] != ':')
+ FILE_FileFixCase(archive);
sprintf(file, "<%s>%s", archive, fileName);
}
else
parent[2] = '\0';
c = 2;
}
+ else if(file[0] == '/' && file[1] == '/')
+ {
+ parent[0] = parent[1] = '\\';
+ parent[2] = '\0';
+ c = 2;
+ }
// Copy Entire Computer to new path
else if(file[0] == '/' && !file[1])
-
+
{
parent[0] = '/';
parent[1] = '\0';
for(;(ch = file[c]) && (ch != '/' && ch != '\\'); c++)
{
if(len < MAX_FILENAME)
- directory[len++] = ch;
+ directory[len++] = ch;
}
directory[len] = '\0';
}
strcpy(file, parent);
}
+#else
+ __ecereNameSpace__ecere__sys__ChangeCh(file, '\\', '/');
#endif
}
-void FILE_FileOpen(char * fileName, FileOpenMode mode, FILE ** input, FILE **output)
+void FILE_FileOpen(const char * fileName, FileOpenMode mode, FILE ** input, FILE **output)
{
#if defined(__WIN32__) && !defined(ECERE_BOOTSTRAP)
uint16 * _wfileName = __ecereNameSpace__ecere__sys__UTF8toUTF16(fileName, null);