diff --git a/src/emu/machine.c b/src/emu/machine.c index d70161c697e..badd3ecc90e 100644 --- a/src/emu/machine.c +++ b/src/emu/machine.c @@ -1217,11 +1217,11 @@ astring &running_machine::nvram_filename(astring &result, device_t &device) const char *software = image_parent_basename(&device); if (software!=NULL && strlen(software)>0) { - result.cat('\\').cat(software); + result.cat(PATH_SEPARATOR).cat(software); } astring tag(device.tag()); tag.del(0, 1).replacechr(':', '_'); - result.cat('\\').cat(tag); + result.cat(PATH_SEPARATOR).cat(tag); } return result; } diff --git a/src/osd/osdcore.h b/src/osd/osdcore.h index ceb0cb45dbc..c7ae389db03 100644 --- a/src/osd/osdcore.h +++ b/src/osd/osdcore.h @@ -28,8 +28,12 @@ /* Make sure we have a path separator (default to /) */ #ifndef PATH_SEPARATOR +#if defined(_WIN32) || defined (__OS2__) +#define PATH_SEPARATOR "\\" +#else #define PATH_SEPARATOR "/" #endif +#endif /* flags controlling file access */ #define OPEN_FLAG_READ 0x0001 /* open for read */ diff --git a/src/osd/sdl/sdlfile.c b/src/osd/sdl/sdlfile.c index a010c02776a..e7293342ede 100644 --- a/src/osd/sdl/sdlfile.c +++ b/src/osd/sdl/sdlfile.c @@ -471,7 +471,7 @@ int osd_get_physical_drive_geometry(const char *filename, UINT32 *cylinders, UIN static int osd_is_path_separator(char c) { - return (c == '/') || (c == '\\'); + return (c == PATHSEPCH) || (c == INVPATHSEPCH); } //============================================================ diff --git a/src/osd/windows/winfile.c b/src/osd/windows/winfile.c index 9f02a547523..795840231b1 100644 --- a/src/osd/windows/winfile.c +++ b/src/osd/windows/winfile.c @@ -48,15 +48,10 @@ extern const char *winfile_ptty_identifier; file_error osd_open(const char *path, UINT32 openflags, osd_file **file, UINT64 *filesize) { - DWORD disposition, access, sharemode; file_error filerr = FILERR_NONE; - const TCHAR *src; - DWORD upper; - TCHAR *t_path; - TCHAR *dst; // convert path to TCHAR - t_path = tstring_from_utf8(path); + TCHAR *t_path = tstring_from_utf8(path); if (t_path == NULL) { filerr = FILERR_OUT_OF_MEMORY; @@ -89,17 +84,15 @@ file_error osd_open(const char *path, UINT32 openflags, osd_file **file, UINT64 (*file)->type = WINFILE_FILE; // convert the path into something Windows compatible - dst = (*file)->filename; -#if defined(SDLMAME_WIN32) || defined(SDLMAME_OS2) - for (src = t_path; *src != 0; src++) - *dst++ = (*src == '/') ? '\\' : *src; -#else - for (src = t_path; *src != 0; src++) - *dst++ = *src;//(*src == '/') ? '\\' : *src; -#endif - *dst++ = 0; + { + TCHAR *dst = (*file)->filename; + for (TCHAR const *src = t_path; *src != 0; src++) + *dst++ = *src;//(*src == '/') ? '\\' : *src; + *dst++ = 0; + } // select the file open modes + DWORD disposition, access, sharemode; if (openflags & OPEN_FLAG_WRITE) { disposition = (!is_path_to_physical_drive(path) && (openflags & OPEN_FLAG_CREATE)) ? CREATE_ALWAYS : OPEN_EXISTING; @@ -149,6 +142,7 @@ file_error osd_open(const char *path, UINT32 openflags, osd_file **file, UINT64 } // get the file size + DWORD upper; *filesize = GetFileSize((*file)->handle, &upper); *filesize |= (UINT64)upper << 32; diff --git a/src/osd/windows/winprefix.h b/src/osd/windows/winprefix.h index e506403e7b5..a705a2f7399 100644 --- a/src/osd/windows/winprefix.h +++ b/src/osd/windows/winprefix.h @@ -45,5 +45,3 @@ static __inline double log2(double x) { return log(x) * M_LOG2E; } #define min(x,y) fmin(x,y) #define max(x,y) fmax(x,y) #endif - -#define PATH_SEPARATOR "\\"