mirror of
https://github.com/clangen/musikcube.git
synced 2024-11-19 20:13:36 +00:00
Added musik::core::GetHomeDirectory(), wired it into DirectoryAdapter
This commit is contained in:
parent
59a2a4794f
commit
4cc9e33c55
@ -88,7 +88,7 @@ std::string musik::core::GetApplicationDirectory() {
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string musik::core::GetDataDirectory() {
|
||||
std::string musik::core::GetHomeDirectory() {
|
||||
std::string directory;
|
||||
|
||||
#ifdef WIN32
|
||||
@ -96,10 +96,20 @@ std::string musik::core::GetDataDirectory() {
|
||||
wchar_t *buffer = new wchar_t[bufferSize + 2];
|
||||
GetEnvironmentVariable(_T("APPDATA"), buffer, bufferSize);
|
||||
directory.assign(u16to8(buffer));
|
||||
directory.append("/mC2/");
|
||||
delete[] buffer;
|
||||
#else
|
||||
directory = std::string(std::getenv("HOME"));
|
||||
#endif
|
||||
|
||||
return directory;
|
||||
}
|
||||
|
||||
std::string musik::core::GetDataDirectory() {
|
||||
std::string directory = GetHomeDirectory();
|
||||
|
||||
#ifdef WIN32
|
||||
directory.append("/mC2/");
|
||||
#else
|
||||
directory.append("/.mC2/");
|
||||
#endif
|
||||
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
namespace musik { namespace core {
|
||||
|
||||
std::string GetHomeDirectory();
|
||||
std::string GetApplicationDirectory();
|
||||
std::string GetDataDirectory();
|
||||
std::string GetPath(const std::string &sFile);
|
||||
|
@ -34,6 +34,8 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <core/support/Common.h>
|
||||
|
||||
#include <cursespp/ScrollAdapterBase.h>
|
||||
#include <cursespp/SingleLineEntry.h>
|
||||
|
||||
@ -67,7 +69,7 @@ void buildDirectoryList(const path& p, std::vector<std::string>& target)
|
||||
}
|
||||
|
||||
DirectoryAdapter::DirectoryAdapter() {
|
||||
this->dir = "/Users/clangen";
|
||||
this->dir = musik::core::GetHomeDirectory();
|
||||
buildDirectoryList(this->dir, this->subdirs);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user