Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Moved the executables out of 'bin', and data out of 'data'.

  • Loading branch information...
commit 07fde3828d86c2ce81d29bea2984a48b42af43c1 1 parent 5b39da3
@Jookia Jookia authored
View
2  build_out/CMakeLists.txt
@@ -13,7 +13,7 @@ install(FILES ${DATA}/ca-bundle_lin.crt
)
install(FILES ${DATA}/cef_data_lin.pak
- DESTINATION ${DATA_INSTALL_DIR}
+ DESTINATION ${DATA_INSTALL_DIR}/data # Ugh, binary Cef packages.
RENAME cef_data.pak
)
View
4 cmake/modules/SetInstallPaths.cmake
@@ -1,5 +1,5 @@
# set this with cmake -DCMAKE_INSTALL_PREFIX=/where/to/install
set(INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
-set(BIN_INSTALL_DIR ${INSTALL_DIR}/bin)
+set(BIN_INSTALL_DIR ${INSTALL_DIR})
set(LIB_INSTALL_DIR ${INSTALL_DIR}/lib)
-set(DATA_INSTALL_DIR ${INSTALL_DIR}/data)
+set(DATA_INSTALL_DIR ${INSTALL_DIR})
View
2  run_desura.sh
@@ -1,4 +1,4 @@
#!/bin/sh
-export PATH="`pwd`/install/bin:$PATH"
+export PATH="`pwd`/install:$PATH"
export LD_LIBRARY_PATH="`pwd`/install/lib:`pwd`/ceflibs"
desura
View
7 src/common/gcJSBase.cpp
@@ -203,11 +203,8 @@ JSObjHandle ToJSObject(ChromiumDLL::JavaScriptFactoryI* factory, const void* cob
DesuraJSBaseNonTemplate::DesuraJSBaseNonTemplate(const char* name, const char* bindingFile)
{
m_szName = gcString(L"Desura/{0}", name);
-#ifdef WIN32
- m_szBindingFile = gcString(".{1}data{1}bindings{1}{0}", bindingFile, DIRS_STR);
-#else
- m_szBindingFile = gcString("data{1}bindings{1}{0}", bindingFile, DIRS_STR);
-#endif
+ m_szBindingFile = gcString("{2}{1}bindings{1}{0}", bindingFile, DIRS_STR,
+ UTIL::OS::getDataPath());
m_pContext = NULL;
}
View
86 src/executable/bootloader_lin/code/UtilFile.cpp
@@ -27,12 +27,13 @@ std::string GetAppPath(std::string extra)
if (count <= 0)
{
- ERROR_OUTPUT("Could not get program directory!");
+ ERROR_OUTPUT("Could not read /proc/self/exe!");
return "";
}
std::string exePath(result);
+ // Cut off the filename.
for(size_t i = count - 1; i > 0; i--)
{
if(result[i] == '/')
@@ -42,88 +43,7 @@ std::string GetAppPath(std::string extra)
}
}
- std::string sResult(result);
- std::string parent;
- std::string nextParent;
-
-
- size_t pos = sResult.find_last_of('/');
- size_t nextPos = sResult.find_last_of('/', pos-1);
- size_t size = (pos-nextPos-1);
-
- if (pos != std::string::npos)
- {
- parent = sResult.substr(pos+1, std::string::npos);
-
- if (nextPos != std::string::npos)
- nextParent = sResult.substr(nextPos+1, size);
- }
-
- if (parent == "desura")
- {
- mkdir("bin", S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH);
-
- if (FileExists("bin/desura"))
- rename("bin/desura", "bin/desura_old");
-
- rename(exePath.c_str(), "bin/desura");
-
- if(extra.size() > 0)
- {
- sResult += "/";
- sResult += extra;
- }
-
- return sResult;
- }
-
-#ifdef DEBUG
- nextParent = "desura";
-#endif
-
- std::string ver = sResult + "/../version";
-
- //if we are the bootloader and not in a desura folder (note: need to check for version to not screw existing installs)
- if (parent != "bin" || (nextParent != "desura" && !FileExists(ver.c_str())))
- {
- if (FileExists("desura_bin"))
- rename("desura_bin", "desura_bin_old");
-
- // If the end of the path (our name) is not desura, and a 'desura' exists
- std::vector<std::string> pathTokens;
- UTIL::STRING::tokenize(exePath, pathTokens, "/");
- if ((pathTokens.size() > 0 && pathTokens[pathTokens.size() - 1] != "desura") && FileExists("desura"))
- rename("desura", "desura_old");
-
- rename(exePath.c_str(), "desura_bin");
- mkdir("desura", S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH);
- mkdir("desura/bin", S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH);
-
- if (FileExists("bin/desura"))
- rename("bin/desura", "bin/desura_old");
-
- rename("desura_bin", "desura/bin/desura");
-
-
- if(extra.size() > 0)
- {
- sResult += "/";
- sResult += extra;
- }
- return sResult + "/desura";
- }
-
- // we actually want one folder above where we are due to executable being in desura/bin/
- sResult = sResult.substr(0, pos);
-
- if(extra.size() > 0)
- {
- sResult += "/";
- sResult += extra;
- }
-
- ERROR_OUTPUT(sResult.c_str());
- return sResult;
+ return result;
}
std::string GetAppDataPath(std::string extra)
View
12 src/executable/desura_browserhost/code/CefThemeLoader.cpp
@@ -45,11 +45,7 @@ bool ThemeLoaderScheme::processRequest(ChromiumDLL::SchemeRequestI* request, boo
UTIL::FS::Path path(themeFolder, url, false);
if (!UTIL::FS::isValidFile(path))
-#ifdef WIN32
- path = UTIL::FS::Path("./data/themes/default", url, false);
-#else
- path = UTIL::FS::Path("data/themes/default", url, false);
-#endif
+ path = UTIL::FS::Path("{0}/themes/default", UTIL::OS::getDataPath(), url, false);
if (!UTIL::FS::isValidFile(path))
return false;
@@ -111,11 +107,7 @@ bool StaticLoaderScheme::processRequest(ChromiumDLL::SchemeRequestI* request, bo
url = url.substr(16);
url = UTIL::STRING::urlDecode(url);
-#ifdef WIN32
- UTIL::FS::Path path("./data/static", url, false);
-#else
- UTIL::FS::Path path("data/static", url, false);
-#endif
+ UTIL::FS::Path path(UTIL::OS::getDataPath("static/"), url, false);
if (!UTIL::FS::isValidFile(path))
return false;
View
6 src/include/util/UtilOs.h
@@ -73,6 +73,12 @@ namespace OS
//!
std::wstring getCurrentDir(std::wstring extra = L"");
+ //! Gets the folder for Desura's data
+ //!
+ //! @param extra Extra path to add to the end of app path
+ //!
+ std::wstring getDataPath(std::wstring extra = L"");
+
//! Gets the folder for saving app data to
//!
//! @param extra Extra path to add to the end of app path
View
2  src/include/webcore/DumpInfo.h
@@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#pragma once
#endif
-#include "webcore\DLLVersion.h"
+#include "webcore/DLLVersion.h"
namespace WebCore
{
View
2  src/include/wx_controls/gcCustomFrame.h
@@ -51,7 +51,7 @@ class gcCustomFrame : public T, public FrameIcon
SetIcon(wxIcon(wxICON(IDI_ICONNORMAL)));
m_FrameIcon = wxIcon("IDI_ICONNORMAL",wxBITMAP_TYPE_ICO_RESOURCE,16,16);
#else
- gcWString path(L"{0}/data/desura.png", UTIL::OS::getCurrentDir());
+ gcWString path(L"{0}/desura.png", UTIL::OS::getDataPath());
wxIcon i(path, wxBITMAP_TYPE_PNG);
SetIcon(i);
#endif
View
26 src/shared/uicore/code/Managers.cpp
@@ -22,24 +22,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
class CIMPORT uploadMng;
-#ifdef WIN32
-
- #define LANGFOLDER ".\\data\\language\\"
- #define THEMEFOLDER ".\\data\\themes"
-
-#else
-
- #define LANGFOLDER "data/language/"
- #define THEMEFOLDER "data/themes"
+inline const char* LANGFOLDER(void)
+{
+ return gcString("{0}{1}language{1}", UTIL::OS::getDataPath(), DIRS_STR).c_str();
+}
-#endif
+inline const char* THEMEFOLDER(void)
+{
+ return gcString("{0}{1}themes{1}", UTIL::OS::getDataPath(), DIRS_STR).c_str();
+}
bool LangChanged(CVar* var, const char* val)
{
if (GetLanguageManager())
{
- gcString lan("{0}{1}.xml", LANGFOLDER, val);
+ gcString lan("{0}{1}.xml", LANGFOLDER(), val);
if (GetLanguageManager()->loadFromFile(lan.c_str()))
{
@@ -61,7 +59,7 @@ bool ThemeChanged(CVar* var, const char* val)
if (!val)
return false;
- UTIL::FS::Path path(THEMEFOLDER, "theme.xml", false);
+ UTIL::FS::Path path(THEMEFOLDER(), "theme.xml", false);
path += val;
bool isValid = UTIL::FS::isValidFile(path);
@@ -78,7 +76,7 @@ CVar gc_theme("gc_theme", "default", CFLAG_SAVEONEXIT, (CVarCallBackFn)&ThemeCha
CONCOMMAND(cc_reloadlanguage, "reload_language")
{
- gcString lan("{0}{1}.xml", LANGFOLDER, gc_language.getString());
+ gcString lan("{0}{1}.xml", LANGFOLDER(), gc_language.getString());
GetLanguageManager()->loadFromFile(lan.c_str());
}
@@ -101,7 +99,7 @@ UserCore::UploadManagerI* GetUploadMng()
void InitLocalManagers()
{
- GetGCThemeManager()->loadFromFolder(THEMEFOLDER);
+ GetGCThemeManager()->loadFromFolder(THEMEFOLDER());
GetGCThemeManager()->loadTheme(gc_theme.getString());
}
View
2  src/shared/uicore/code/TaskBarIcon.cpp
@@ -102,7 +102,7 @@ TaskBarIcon::TaskBarIcon(wxWindow *parent) : gcTaskBarIcon()
m_wxIcon = wxIcon(wxICON(IDI_ICONSMALL));
SetIcon(m_wxIcon , m_szTooltip);
#else
- gcWString path(L"{0}/data/desura.png", UTIL::OS::getCurrentDir());
+ gcWString path(L"{0}/desura.png", UTIL::OS::getDataPath());
wxIcon i(path, wxBITMAP_TYPE_PNG);
SetIcon(i, m_szTooltip);
#endif
View
2  src/shared/uicore/code/TaskBarIcon_Ballon.cpp
@@ -89,7 +89,7 @@ void TaskBarIcon::onAppUpdateProg(uint32& prog)
#ifdef WIN32
SetIcon(m_wxIcon, m_szTooltip);
#else
- gcWString path(L"{0}/data/desura.png", UTIL::OS::getCurrentDir());
+ gcWString path(L"{0}/desura.png", UTIL::OS::getDataPath());
wxIcon i(path, wxBITMAP_TYPE_PNG);
SetIcon(i, m_szTooltip);
#endif
View
4 src/shared/uicore/code/gcImgLoader.cpp
@@ -36,7 +36,7 @@ bool ImgLoaderScheme::processRequest(ChromiumDLL::SchemeRequestI* request, bool*
gcString url = wurl;
url = url.substr(20);
- UTIL::FS::Path file(".\\data\\themes", "", false);
+ UTIL::FS::Path file(UTIL::OS::getDataPath(L"/themes"), L"", false);
UTIL::FS::Path img = UTIL::FS::PathWithFile(url);
file += img;
@@ -100,4 +100,4 @@ bool ImgLoaderScheme::read(char* buffer, int size, int* readSize)
*readSize = size;
return true;
-}
+}
View
10 src/shared/uicore/code/gcJSSettings.cpp
@@ -92,11 +92,7 @@ std::vector<MapElementI*> DesuraJSSettings::getThemes()
for (size_t x=0; x<m_vThemes.size(); x++)
{
-#ifdef WIN32
- UTIL::FS::Path file(gcString(".{0}data{0}themes", DIRS_STR), "", false);
-#else
- UTIL::FS::Path file("data/themes", "", false);
-#endif
+ UTIL::FS::Path file(UTIL::OS::getDataPath(L"/themes"), L"", false);
UTIL::FS::Path themePath = UTIL::FS::PathWithFile(m_vThemes[x]->getPreview());
file += themePath;
@@ -132,7 +128,9 @@ std::vector<MapElementI*> DesuraJSSettings::getLanguages()
std::vector<std::string> filter;
filter.push_back("xml");
- UTIL::FS::getAllFiles(UTIL::FS::Path(".\\data\\language", "", false), fileList, &filter);
+ UTIL::FS::getAllFiles(UTIL::FS::Path(UTIL::OS::getDataPath(L"/language"),
+ L"", false), fileList, &filter);
+
std::map<gcString, uint32> mSeenBefore;
for (size_t x=0; x<fileList.size(); x++)
View
14 src/shared/uicore/code/gcThemeLoader.cpp
@@ -42,11 +42,8 @@ bool ThemeLoaderScheme::processRequest(ChromiumDLL::SchemeRequestI* request, boo
UTIL::FS::Path path(themeFolder, url, false);
if (!UTIL::FS::isValidFile(path))
-#ifdef WIN32
- path = UTIL::FS::Path("./data/themes/default", url, false);
-#else
- path = UTIL::FS::Path("data/themes/default", url, false);
-#endif
+ path = UTIL::FS::Path(UTIL::OS::getDataPath(L"/themes/default"),
+ UTIL::STRING::toWStr(url), false);
if (!UTIL::FS::isValidFile(path))
return false;
@@ -101,11 +98,8 @@ bool StaticLoaderScheme::processRequest(ChromiumDLL::SchemeRequestI* request, bo
url = url.substr(16);
url = UTIL::STRING::urlDecode(url);
-#ifdef WIN32
- UTIL::FS::Path path("./data/static", url, false);
-#else
- UTIL::FS::Path path("data/static", url, false);
-#endif
+ UTIL::FS::Path path(gcString("{0}/static", UTIL::OS::getDataPath()), url, false);
+
if (!UTIL::FS::isValidFile(path))
return false;
View
6 src/shared/usercore/code/ItemHandle_nix.cpp
@@ -204,8 +204,10 @@ void ItemHandle::installLaunchScripts()
try
{
- UTIL::FS::readWholeFile("./data/scripts/launch_bin_template.sh", &scriptBin);
- UTIL::FS::readWholeFile("./data/scripts/launch_xdg_template.sh", &scriptXdg);
+ UTIL::FS::readWholeFile(UTIL::STRING::toStr(
+ UTIL::OS::getDataPath(L"/scripts/launch_bin_template.sh")), &scriptBin);
+ UTIL::FS::readWholeFile(UTIL::STRING::toStr(
+ UTIL::OS::getDataPath(L"/scripts/launch_xdg_template.sh")), &scriptXdg);
}
catch (gcException &e)
{
View
2  src/shared/utilcore/code/UtilCoreMain.cpp
@@ -39,6 +39,8 @@ HINSTANCE g_hInstDLL;
bool InitWebControl();
void ShutdownWebControl();
+// TODO: Fix this to use UTIL::OS::getDataPath instead of data/.
+
#ifdef WIN32
#define LANGFOLDER ".\\data\\language\\"
#define THEMEFOLDER ".\\data\\themes"
View
7 src/shared/webcore/code/WebCore_Internal.cpp
@@ -40,11 +40,8 @@ TiXmlNode* WebCoreClass::postToServer(std::string url, std::string resource, Pos
if (useHTTPS)
{
hh->setUserAgent(getUserAgent());
-#ifdef WIN32
- hh->setCertFile(".\\data\\ca-bundle.crt");
-#else
- hh->setCertFile("data/ca-bundle.crt");
-#endif
+ hh->setCertFile(
+ UTIL::STRING::toStr(UTIL::OS::getDataPath(L"/ca-bundle.crt")).c_str());
}
else
{
View
14 src/static/managers/code/Managers.cpp
@@ -26,11 +26,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#include "CVarManager.h"
#include "ConCommandManager.h"
-#ifdef WIN32
-#define LANG_DEF ".\\data\\language\\english.xml"
-#else
-#define LANG_DEF "data/language/english.xml"
-#endif
+inline const char* LANG_DEF(void)
+{
+ std::wstring path = UTIL::OS::getDataPath(L"/language/english.xml");
+
+ return UTIL::STRING::toStr(path).c_str();
+}
+
namespace Managers
{
@@ -83,7 +85,7 @@ class ManagersImpl
void InitManagers()
{
//must load lang first as the cvar gc_lang needs it
- m_pLanguageManager = new LanguageManager(LANG_DEF);
+ m_pLanguageManager = new LanguageManager(LANG_DEF());
InitCVarManger();
InitConComManger();
View
7 src/static/managers/code/Theme.cpp
@@ -103,7 +103,7 @@ void Theme::parseFile(const char* file)
}
const char* name = pChild->ToElement()->Attribute("name");
- const char* val= pChild->ToElement()->GetText();
+ const char* val = pChild->ToElement()->GetText();
if (name && val)
{
@@ -152,11 +152,8 @@ void Theme::parseFile(const char* file)
if (name && val)
{
std::string outVal = UTIL::STRING::sanitizeFileName(val);
-#ifdef WIN32
+
gcString fullPath("file:///{0}/html/{1}", urlPath, outVal);
-#else
- gcString fullPath("file://{2}/{0}/html/{1}", urlPath, outVal, UTIL::OS::getCurrentDir());
-#endif
ThemeWebInfo* web = WebList::findItem(name);
View
4 src/static/util/code/UtilLinux.cpp
@@ -188,10 +188,6 @@ class WorkingDir
}
path = result;
-
- // we actually want one folder above where we are due to executable being in desura/bin/
- path.erase(path.find_last_of(L'/'));
-
}
gcWString path;
View
7 src/static/util/code/UtilOs.cpp
@@ -135,6 +135,13 @@ std::wstring getCurrentDir(std::wstring extra)
#endif
}
+std::wstring getDataPath(std::wstring extra)
+{
+ std::wstring dataDir = L""; // Use to be 'data'.
+
+ return getCurrentDir(dataDir + extra);
+}
+
std::wstring getAppDataPath(std::wstring extra)
{
#ifdef NIX
Please sign in to comment.
Something went wrong with that request. Please try again.