Fix creation of paths

This commit is contained in:
Vas Crabb 2015-03-31 01:43:27 +11:00
parent 2f3d1de477
commit 945ff007a6
5 changed files with 16 additions and 20 deletions

View File

@ -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;
}

View File

@ -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 */

View File

@ -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);
}
//============================================================

View File

@ -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;

View File

@ -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 "\\"