Ported wxutils from soap branch (Should make launch and explore work in Linux and osx as well) please test on windows.
Fixed a compile bug and a small bug in the cdutils(thanks lp). git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2420 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
e59869e63c
commit
ab93b00385
|
@ -2,7 +2,6 @@
|
||||||
With minor adjustments */
|
With minor adjustments */
|
||||||
|
|
||||||
#include "CDUtils.h"
|
#include "CDUtils.h"
|
||||||
#include "common.h"
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Follow symlinks until we have the real device file
|
Follow symlinks until we have the real device file
|
||||||
|
@ -413,7 +412,7 @@ bool cdio_is_cdrom(const char *device) {
|
||||||
char **devices = cdio_get_devices();
|
char **devices = cdio_get_devices();
|
||||||
bool res = false;
|
bool res = false;
|
||||||
for (int i = 0; devices[i] != NULL; i++) {
|
for (int i = 0; devices[i] != NULL; i++) {
|
||||||
if (strncmp(devices[i], device, PATH_MAX)) {
|
if (strncmp(devices[i], device, PATH_MAX) == 0) {
|
||||||
res = true;
|
res = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,36 +113,6 @@ std::string SanitizePath(const char *filename)
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Launch(const char *filename)
|
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
|
||||||
std::string win_filename = SanitizePath(filename);
|
|
||||||
SHELLEXECUTEINFO shex = { sizeof(shex) };
|
|
||||||
shex.fMask = SEE_MASK_NO_CONSOLE; // | SEE_MASK_ASYNC_OK;
|
|
||||||
shex.lpVerb = "open";
|
|
||||||
shex.lpFile = win_filename.c_str();
|
|
||||||
shex.nShow = SW_SHOWNORMAL;
|
|
||||||
ShellExecuteEx(&shex);
|
|
||||||
#else
|
|
||||||
// TODO: Insert GNOME/KDE code here.
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void Explore(const char *path)
|
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
|
||||||
std::string win_path = SanitizePath(path);
|
|
||||||
SHELLEXECUTEINFO shex = { sizeof(shex) };
|
|
||||||
shex.fMask = SEE_MASK_NO_CONSOLE; // | SEE_MASK_ASYNC_OK;
|
|
||||||
shex.lpVerb = "explore";
|
|
||||||
shex.lpFile = win_path.c_str();
|
|
||||||
shex.nShow = SW_SHOWNORMAL;
|
|
||||||
ShellExecuteEx(&shex);
|
|
||||||
#else
|
|
||||||
// TODO: Insert GNOME/KDE code here.
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns true if successful, or path already exists.
|
// Returns true if successful, or path already exists.
|
||||||
bool CreateDir(const char *path)
|
bool CreateDir(const char *path)
|
||||||
{
|
{
|
||||||
|
@ -545,3 +515,4 @@ bool SetCurrentDirectory(const std::string& _rDirectory)
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,6 @@ struct FSTEntry
|
||||||
|
|
||||||
std::string SanitizePath(const char *filename);
|
std::string SanitizePath(const char *filename);
|
||||||
bool Exists(const char *filename);
|
bool Exists(const char *filename);
|
||||||
void Launch(const char *filename);
|
|
||||||
void Explore(const char *path);
|
|
||||||
bool IsDirectory(const char *filename);
|
bool IsDirectory(const char *filename);
|
||||||
bool IsDisk(const char *filename);
|
bool IsDisk(const char *filename);
|
||||||
bool CreateDir(const char *filename);
|
bool CreateDir(const char *filename);
|
||||||
|
|
|
@ -457,6 +457,14 @@
|
||||||
RelativePath=".\src\RegisterView.h"
|
RelativePath=".\src\RegisterView.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\WxUtils.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\WxUtils.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Resources"
|
Name="Resources"
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
|
|
||||||
// ugly that this lib included code from the main
|
// ugly that this lib included code from the main
|
||||||
#include "../../DolphinWX/Src/Globals.h"
|
#include "../../DolphinWX/Src/Globals.h"
|
||||||
|
#include "../../DolphinWX/Src/WxUtils.h"
|
||||||
|
|
||||||
#include "Host.h"
|
#include "Host.h"
|
||||||
|
|
||||||
|
@ -42,11 +43,11 @@
|
||||||
#include "BreakpointWindow.h"
|
#include "BreakpointWindow.h"
|
||||||
#include "MemoryWindow.h"
|
#include "MemoryWindow.h"
|
||||||
#include "JitWindow.h"
|
#include "JitWindow.h"
|
||||||
|
#include "FileUtil.h"
|
||||||
|
|
||||||
#include "CodeWindow.h"
|
#include "CodeWindow.h"
|
||||||
#include "CodeView.h"
|
#include "CodeView.h"
|
||||||
|
|
||||||
#include "FileUtil.h"
|
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
#include "HLE/HLE.h"
|
#include "HLE/HLE.h"
|
||||||
#include "Boot/Boot.h"
|
#include "Boot/Boot.h"
|
||||||
|
@ -133,7 +134,7 @@ void CCodeWindow::OnProfilerMenu(wxCommandEvent& event)
|
||||||
break;
|
break;
|
||||||
case IDM_WRITEPROFILE:
|
case IDM_WRITEPROFILE:
|
||||||
Profiler::WriteProfileResults("profiler.txt");
|
Profiler::WriteProfileResults("profiler.txt");
|
||||||
File::Launch("profiler.txt");
|
WxUtils::Launch("profiler.txt");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,8 @@ be accessed from Core::GetWindowHandle().
|
||||||
|
|
||||||
#include <wx/datetime.h> // wxWidgets
|
#include <wx/datetime.h> // wxWidgets
|
||||||
|
|
||||||
|
// ugly that this lib included code from the main
|
||||||
|
#include "../../DolphinWX/Src/WxUtils.h"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Resources
|
// Resources
|
||||||
|
@ -624,10 +626,10 @@ void CFrame::OnHelp(wxCommandEvent& event)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IDM_HELPWEBSITE:
|
case IDM_HELPWEBSITE:
|
||||||
File::Launch("http://www.dolphin-emu.com/");
|
WxUtils::Launch("http://www.dolphin-emu.com/");
|
||||||
break;
|
break;
|
||||||
case IDM_HELPGOOGLECODE:
|
case IDM_HELPGOOGLECODE:
|
||||||
File::Launch("http://code.google.com/p/dolphin-emu/");
|
WxUtils::Launch("http://code.google.com/p/dolphin-emu/");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,13 +23,13 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "FileSearch.h"
|
#include "FileSearch.h"
|
||||||
#include "FileUtil.h"
|
|
||||||
#include "StringUtil.h"
|
#include "StringUtil.h"
|
||||||
#include "ConfigManager.h"
|
#include "ConfigManager.h"
|
||||||
#include "GameListCtrl.h"
|
#include "GameListCtrl.h"
|
||||||
#include "Blob.h"
|
#include "Blob.h"
|
||||||
#include "ISOProperties.h"
|
#include "ISOProperties.h"
|
||||||
#include "IniFile.h"
|
#include "IniFile.h"
|
||||||
|
#include "FileUtil.h"
|
||||||
|
|
||||||
#if USE_XPM_BITMAPS
|
#if USE_XPM_BITMAPS
|
||||||
#include "../resources/Flag_Europe.xpm"
|
#include "../resources/Flag_Europe.xpm"
|
||||||
|
@ -38,6 +38,9 @@
|
||||||
#include "../resources/Flag_USA.xpm"
|
#include "../resources/Flag_USA.xpm"
|
||||||
#endif // USE_XPM_BITMAPS
|
#endif // USE_XPM_BITMAPS
|
||||||
|
|
||||||
|
// ugly that this lib included code from the main
|
||||||
|
#include "../../DolphinWX/Src/WxUtils.h"
|
||||||
|
|
||||||
size_t CGameListCtrl::m_currentItem = 0;
|
size_t CGameListCtrl::m_currentItem = 0;
|
||||||
size_t CGameListCtrl::m_numberItem = 0;
|
size_t CGameListCtrl::m_numberItem = 0;
|
||||||
std::string CGameListCtrl::m_currentFilename;
|
std::string CGameListCtrl::m_currentFilename;
|
||||||
|
@ -636,7 +639,7 @@ void CGameListCtrl::OnOpenContainingFolder(wxCommandEvent& WXUNUSED (event))
|
||||||
return;
|
return;
|
||||||
std::string path;
|
std::string path;
|
||||||
SplitPath(iso->GetFileName(), &path, 0, 0);
|
SplitPath(iso->GetFileName(), &path, 0, 0);
|
||||||
File::Explore(path.c_str());
|
WxUtils::Explore(path.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ if wxenv['HAVE_WX']:
|
||||||
'stdafx.cpp',
|
'stdafx.cpp',
|
||||||
'FrameWiimote.cpp',
|
'FrameWiimote.cpp',
|
||||||
'SDCardWindow.cpp',
|
'SDCardWindow.cpp',
|
||||||
|
'WxUtils.cpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
CPPDEFINES = [
|
CPPDEFINES = [
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
#include "Common.h"
|
||||||
|
#include <wx/wx.h>
|
||||||
|
#include <wx/string.h>
|
||||||
|
namespace WxUtils {
|
||||||
|
|
||||||
|
// Launch a file according to its mime type
|
||||||
|
void Launch(const char *filename)
|
||||||
|
{
|
||||||
|
if (! ::wxLaunchDefaultBrowser(wxString::FromAscii(filename))) {
|
||||||
|
// WARN_LOG
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Launch an file explorer window on a certain path
|
||||||
|
void Explore(const char *path)
|
||||||
|
{
|
||||||
|
wxString wxPath = wxString::FromAscii(path);
|
||||||
|
|
||||||
|
// Default to file
|
||||||
|
if (! wxPath.Contains(wxT("://"))) {
|
||||||
|
wxPath = wxT("file://") + wxPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! ::wxLaunchDefaultBrowser(wxPath)) {
|
||||||
|
// WARN_LOG
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
#ifndef WXUTILS_H
|
||||||
|
#define WXUTILS_H
|
||||||
|
|
||||||
|
namespace WxUtils {
|
||||||
|
// Launch a file according to its mime type
|
||||||
|
void Launch(const char *filename);
|
||||||
|
|
||||||
|
// Launch an file explorer window on a certain path
|
||||||
|
void Explore(const char *path);
|
||||||
|
|
||||||
|
} // NameSpace WxUtils
|
||||||
|
#endif // WXUTILS
|
Loading…
Reference in New Issue