Fix slashes for Linux

This commit is contained in:
Sacha 2014-03-17 23:41:15 +10:00
parent a00f47b5e4
commit 6968137bbc
7 changed files with 20 additions and 21 deletions

View File

@ -226,7 +226,6 @@ vfsDevice* VFS::GetDevice(const wxString& ps3_path, wxString& path) const
} }
if(max_i < 0) return nullptr; if(max_i < 0) return nullptr;
path = vfsDevice::GetWinPath(m_devices[max_i].GetLocalPath(), ps3_path(max_eq, ps3_path.Len() - max_eq)); path = vfsDevice::GetWinPath(m_devices[max_i].GetLocalPath(), ps3_path(max_eq, ps3_path.Len() - max_eq));
return &m_devices[max_i]; return &m_devices[max_i];
} }
@ -303,27 +302,27 @@ void VFS::SaveLoadDevices(Array<VFSManagerEntry>& res, bool is_load)
{ {
int idx; int idx;
idx = res.Move(new VFSManagerEntry()); idx = res.Move(new VFSManagerEntry());
res[idx].path = "$(EmulatorDir)\\dev_hdd0\\"; res[idx].path = "$(EmulatorDir)/dev_hdd0/";
res[idx].mount = "/dev_hdd0/"; res[idx].mount = "/dev_hdd0/";
res[idx].device = vfsDevice_LocalFile; res[idx].device = vfsDevice_LocalFile;
idx = res.Move(new VFSManagerEntry()); idx = res.Move(new VFSManagerEntry());
res[idx].path = "$(EmulatorDir)\\dev_hdd1\\"; res[idx].path = "$(EmulatorDir)/dev_hdd1/";
res[idx].mount = "/dev_hdd1/"; res[idx].mount = "/dev_hdd1/";
res[idx].device = vfsDevice_LocalFile; res[idx].device = vfsDevice_LocalFile;
idx = res.Move(new VFSManagerEntry()); idx = res.Move(new VFSManagerEntry());
res[idx].path = "$(EmulatorDir)\\dev_flash\\"; res[idx].path = "$(EmulatorDir)/dev_flash/";
res[idx].mount = "/dev_flash/"; res[idx].mount = "/dev_flash/";
res[idx].device = vfsDevice_LocalFile; res[idx].device = vfsDevice_LocalFile;
idx = res.Move(new VFSManagerEntry()); idx = res.Move(new VFSManagerEntry());
res[idx].path = "$(EmulatorDir)\\dev_usb000\\"; res[idx].path = "$(EmulatorDir)/dev_usb000/";
res[idx].mount = "/dev_usb000/"; res[idx].mount = "/dev_usb000/";
res[idx].device = vfsDevice_LocalFile; res[idx].device = vfsDevice_LocalFile;
idx = res.Move(new VFSManagerEntry()); idx = res.Move(new VFSManagerEntry());
res[idx].path = "$(EmulatorDir)\\dev_usb000\\"; res[idx].path = "$(EmulatorDir)/dev_usb000/";
res[idx].mount = "/dev_usb/"; res[idx].mount = "/dev_usb/";
res[idx].device = vfsDevice_LocalFile; res[idx].device = vfsDevice_LocalFile;
@ -333,7 +332,7 @@ void VFS::SaveLoadDevices(Array<VFSManagerEntry>& res, bool is_load)
res[idx].device = vfsDevice_LocalFile; res[idx].device = vfsDevice_LocalFile;
idx = res.Move(new VFSManagerEntry()); idx = res.Move(new VFSManagerEntry());
res[idx].path = "$(GameDir)\\..\\"; res[idx].path = "$(GameDir)/../";
res[idx].mount = "/dev_bdvd/"; res[idx].mount = "/dev_bdvd/";
res[idx].device = vfsDevice_LocalFile; res[idx].device = vfsDevice_LocalFile;

View File

@ -48,8 +48,8 @@ u32 vfsDevice::CmpLocalPath(const wxString& local_path)
wxFileName path0(m_local_path); wxFileName path0(m_local_path);
path0.Normalize(); path0.Normalize();
wxArrayString arr0 = wxSplit(path0.GetFullPath(), '\\'); wxArrayString arr0 = wxSplit(path0.GetFullPath(), '/');
wxArrayString arr1 = wxSplit(local_path, '\\'); wxArrayString arr1 = wxSplit(local_path, '/');
const u32 lim = min(arr0.GetCount(), arr1.GetCount()); const u32 lim = min(arr0.GetCount(), arr1.GetCount());
u32 ret = 0; u32 ret = 0;
@ -168,7 +168,7 @@ wxString vfsDevice::GetWinPath(const wxString& p, bool is_dir)
{ {
if(!is_ls) if(!is_ls)
{ {
ret += '\\'; ret += '/';
is_ls = true; is_ls = true;
} }
@ -179,7 +179,7 @@ wxString vfsDevice::GetWinPath(const wxString& p, bool is_dir)
ret += p[i]; ret += p[i];
} }
if(is_dir && ret[ret.Len() - 1] != '\\') ret += '\\'; if(is_dir && ret[ret.Len() - 1] != '/') ret += '/';
wxFileName res(ret); wxFileName res(ret);
res.Normalize(); res.Normalize();
@ -191,7 +191,7 @@ wxString vfsDevice::GetWinPath(const wxString& l, const wxString& r)
if(l.IsEmpty()) return GetWinPath(r, false); if(l.IsEmpty()) return GetWinPath(r, false);
if(r.IsEmpty()) return GetWinPath(l); if(r.IsEmpty()) return GetWinPath(l);
return GetWinPath(l + '\\' + r, false); return GetWinPath(l + '/' + r, false);
} }
wxString vfsDevice::GetPs3Path(const wxString& p, bool is_dir) wxString vfsDevice::GetPs3Path(const wxString& p, bool is_dir)

View File

@ -56,7 +56,7 @@ bool vfsLocalFile::Create(const wxString& path)
for(uint p=1; p < path.Len() && path[p] != '\0' ; p++) for(uint p=1; p < path.Len() && path[p] != '\0' ; p++)
{ {
for(; p < path.Len() && path[p] != '\0'; p++) for(; p < path.Len() && path[p] != '\0'; p++)
if(path[p] == '\\') break; if(path[p] == '/') break;
if(p == path.Len() || path[p] == '\0') if(p == path.Len() || path[p] == '\0')
break; break;
@ -70,7 +70,7 @@ bool vfsLocalFile::Create(const wxString& path)
} }
//create file //create file
if(path(path.Len() - 1, 1) != '\\' && !wxFileExists(path)) if(path(path.Len() - 1, 1) != '/' && !wxFileExists(path))
{ {
wxFile f; wxFile f;
return f.Create(path); return f.Create(path);

View File

@ -302,7 +302,7 @@ public:
void Save(RSXTexture& tex) void Save(RSXTexture& tex)
{ {
static const wxString& dir_path = "textures"; static const wxString& dir_path = "textures";
static const wxString& file_fmt = dir_path + "\\" + "tex[%d].png"; static const wxString& file_fmt = dir_path + "/" + "tex[%d].png";
if(!wxDirExists(dir_path)) wxMkdir(dir_path); if(!wxDirExists(dir_path)) wxMkdir(dir_path);

View File

@ -695,7 +695,7 @@ public:
do do
{ {
if(s[pos] == '\\' || s[pos] == '\0') if(s[pos] == '/' || s[pos] == '\0')
{ {
if(file_pos != -1) if(file_pos != -1)
{ {

View File

@ -141,7 +141,7 @@ void Emulator::Load()
m_path = elf_path; m_path = elf_path;
} }
ConLog.Write("Loading '%s'...", m_path.wx_str()); ConLog.Write("Loading '%s'...", m_path.ToStdString().c_str());
GetInfo().Reset(); GetInfo().Reset();
m_vfs.Init(m_path); m_vfs.Init(m_path);
@ -149,7 +149,7 @@ void Emulator::Load()
ConLog.Write("Mount info:"); ConLog.Write("Mount info:");
for(uint i=0; i<m_vfs.m_devices.GetCount(); ++i) for(uint i=0; i<m_vfs.m_devices.GetCount(); ++i)
{ {
ConLog.Write("%s -> %s", m_vfs.m_devices[i].GetPs3Path().wx_str(), m_vfs.m_devices[i].GetLocalPath().wx_str()); ConLog.Write("%s -> %s", m_vfs.m_devices[i].GetPs3Path().ToStdString().c_str(), m_vfs.m_devices[i].GetLocalPath().ToStdString().c_str());
} }
ConLog.SkipLn(); ConLog.SkipLn();
@ -162,7 +162,7 @@ void Emulator::Load()
if(!f.IsOpened()) if(!f.IsOpened())
{ {
ConLog.Error("Elf not found! (%s - %s)", m_path.wx_str(), m_elf_path.wx_str()); ConLog.Error("Elf not found! (%s - %s)", m_path.ToStdString().c_str(), m_elf_path.ToStdString().c_str());
return; return;
} }
@ -441,7 +441,7 @@ void Emulator::LoadPoints(const std::string& path)
if(version != bpdb_version || if(version != bpdb_version ||
(sizeof(u16) + break_count * sizeof(u64) + sizeof(u32) + marked_count * sizeof(u64) + sizeof(u32)) != length) (sizeof(u16) + break_count * sizeof(u64) + sizeof(u32) + marked_count * sizeof(u64) + sizeof(u32)) != length)
{ {
ConLog.Error("'%s' is broken", wxString(path).wx_str()); ConLog.Error("'%s' is broken", path.c_str());
return; return;
} }

View File

@ -202,7 +202,7 @@ void MainFrame::BootGame(wxCommandEvent& WXUNUSED(event))
} }
else else
{ {
ConLog.Error("Ps3 executable not found in selected folder (%s)", ctrl.GetPath().wx_str()); ConLog.Error("Ps3 executable not found in selected folder (%s)", ctrl.GetPath().ToStdString().c_str());
} }
} }