mirror of
https://github.com/clangen/musikcube.git
synced 2024-11-19 11:10:52 +00:00
- Fixed websocket_remote.vcxproj
- Migrate ~/.mC2 to ~/.musikcube. this has been a long time coming.
This commit is contained in:
parent
ac48e3edf6
commit
19c4d2ae22
@ -12,6 +12,8 @@
|
||||
contexts
|
||||
* fixed the win32 global volume up / volume down hotkeys to be consistent with
|
||||
the main app and `websocket_remote` behavior.
|
||||
* changed data directory from "~/.mC2" to "~/.musikcube". the app will
|
||||
automatically perform this rename on startup.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
@ -71,7 +71,8 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\plugins\</OutDir>
|
||||
<IntDir>.\obj\$(Configuration)\</IntDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<LinkIncremental>
|
||||
</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(SolutionDir)\bin\$(Configuration)\plugins\</OutDir>
|
||||
@ -82,13 +83,13 @@
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>3rdparty/include;../../;../../../../boost_1_60_0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>3rdparty/include;3rdparty/win32/include;../../;../../../../boost_1_60_0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;ZLIB_WINAPI;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>../../../../boost_1_60_0/lib32-msvc-14.0;3rdparty/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>../../../../boost_1_60_0/lib32-msvc-14.0;3rdparty/lib;3rdparty/win32/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>zlibstatD.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>
|
||||
@ -109,8 +110,8 @@
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>3rdparty/include;../../;../../../../boost_1_60_0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>3rdparty/include;3rdparty/win32/include;../../;../../../../boost_1_60_0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;ZLIB_WINAPI;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
@ -119,8 +120,8 @@
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>../../../../boost_1_60_0/lib32-msvc-14.0;3rdparty/lib</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>../../../../boost_1_60_0/lib32-msvc-14.0;3rdparty/lib;3rdparty/win32/lib</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>zlibstat.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
|
@ -89,42 +89,75 @@ std::string musik::core::GetApplicationDirectory() {
|
||||
std::string musik::core::GetHomeDirectory() {
|
||||
std::string directory;
|
||||
|
||||
#ifdef WIN32
|
||||
DWORD bufferSize = GetEnvironmentVariable(L"USERPROFILE", 0, 0);
|
||||
wchar_t *buffer = new wchar_t[bufferSize + 2];
|
||||
GetEnvironmentVariable(L"USERPROFILE", buffer, bufferSize);
|
||||
directory.assign(u16to8(buffer));
|
||||
delete[] buffer;
|
||||
#else
|
||||
directory = std::string(std::getenv("HOME"));
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
DWORD bufferSize = GetEnvironmentVariable(L"USERPROFILE", 0, 0);
|
||||
wchar_t *buffer = new wchar_t[bufferSize + 2];
|
||||
GetEnvironmentVariable(L"USERPROFILE", buffer, bufferSize);
|
||||
directory.assign(u16to8(buffer));
|
||||
delete[] buffer;
|
||||
#else
|
||||
directory = std::string(std::getenv("HOME"));
|
||||
#endif
|
||||
|
||||
return directory;
|
||||
}
|
||||
|
||||
std::string musik::core::GetDataDirectory() {
|
||||
static std::string GetDataDirectoryRoot() {
|
||||
std::string directory;
|
||||
|
||||
#ifdef WIN32
|
||||
DWORD bufferSize = GetEnvironmentVariable(L"APPDATA", 0, 0);
|
||||
wchar_t *buffer = new wchar_t[bufferSize + 2];
|
||||
GetEnvironmentVariable(L"APPDATA", buffer, bufferSize);
|
||||
directory.assign(u16to8(buffer));
|
||||
directory.append("/mC2/");
|
||||
delete[] buffer;
|
||||
#else
|
||||
directory = std::string(std::getenv("HOME"));
|
||||
directory.append("/.mC2/");
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
DWORD bufferSize = GetEnvironmentVariable(L"APPDATA", 0, 0);
|
||||
wchar_t *buffer = new wchar_t[bufferSize + 2];
|
||||
GetEnvironmentVariable(L"APPDATA", buffer, bufferSize);
|
||||
directory.assign(u16to8(buffer));
|
||||
delete[] buffer;
|
||||
#else
|
||||
directory = std::string(std::getenv("HOME"));
|
||||
#endif
|
||||
|
||||
boost::filesystem::path path(directory);
|
||||
if (!boost::filesystem::exists(path)) {
|
||||
boost::filesystem::create_directories(path);
|
||||
return directory;
|
||||
}
|
||||
|
||||
std::string musik::core::GetDataDirectory(bool create) {
|
||||
std::string directory =
|
||||
|
||||
#ifdef WIN32
|
||||
GetDataDirectoryRoot() + std::string("/musikcube/");
|
||||
#else
|
||||
GetDataDirectoryRoot() + std::string("/.musikcube/");
|
||||
#endif
|
||||
|
||||
if (create) {
|
||||
boost::filesystem::path path(directory);
|
||||
if (!boost::filesystem::exists(path)) {
|
||||
boost::filesystem::create_directories(path);
|
||||
}
|
||||
}
|
||||
|
||||
return directory;
|
||||
}
|
||||
|
||||
void musik::core::MigrateOldDataDirectory() {
|
||||
std::string oldDirectory =
|
||||
|
||||
#ifdef WIN32
|
||||
GetDataDirectoryRoot() + std::string("/mC2/");
|
||||
#else
|
||||
GetDataDirectoryRoot() + std::string("/.mC2/");
|
||||
#endif
|
||||
|
||||
std::string newDirectory = GetDataDirectory(false);
|
||||
|
||||
boost::filesystem::path oldPath(oldDirectory);
|
||||
boost::filesystem::path newPath(newDirectory);
|
||||
|
||||
if (boost::filesystem::exists(oldPath) &&
|
||||
!boost::filesystem::exists(newPath))
|
||||
{
|
||||
boost::filesystem::rename(oldPath, newPath);
|
||||
}
|
||||
}
|
||||
|
||||
std::string musik::core::GetPath(const std::string &sFile) {
|
||||
std::string sPath;
|
||||
int length;
|
||||
@ -144,11 +177,11 @@ std::string musik::core::GetPath(const std::string &sFile) {
|
||||
else {
|
||||
sPath.assign(sFile);
|
||||
}
|
||||
#else //TODO: check this POSIX GetPath works
|
||||
#else
|
||||
char* szDir;
|
||||
sPath.assign(getcwd((char*)szDir, (size_t) length));
|
||||
#endif
|
||||
|
||||
#endif //WIN32
|
||||
return sPath;
|
||||
}
|
||||
|
||||
|
@ -41,10 +41,13 @@ namespace musik { namespace core {
|
||||
|
||||
std::string GetHomeDirectory();
|
||||
std::string GetApplicationDirectory();
|
||||
std::string GetDataDirectory();
|
||||
std::string GetDataDirectory(bool create = true);
|
||||
std::string GetPath(const std::string &sFile);
|
||||
std::string GetPluginDirectory();
|
||||
uint64 Checksum(char *data,unsigned int bytes);
|
||||
size_t CopyString(const std::string& src, char* dst, size_t size);
|
||||
|
||||
/* renames ~/.mC2 -> ~/.musikcube */
|
||||
void MigrateOldDataDirectory();
|
||||
|
||||
} }
|
||||
|
@ -57,6 +57,7 @@
|
||||
#include <core/plugin/Plugins.h>
|
||||
#include <core/support/PreferenceKeys.h>
|
||||
#include <core/audio/Visualizer.h>
|
||||
#include <core/support/Common.h>
|
||||
|
||||
#include <boost/locale.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
@ -112,6 +113,8 @@ int main(int argc, char* argv[])
|
||||
resize_term(26, 100); /* must be before app init */
|
||||
#endif
|
||||
|
||||
musik::core::MigrateOldDataDirectory();
|
||||
|
||||
musik::debug::init();
|
||||
|
||||
ILibraryPtr library = LibraryFactory::Libraries().at(0);
|
||||
|
Loading…
Reference in New Issue
Block a user