Pass cache location
This commit is contained in:
@@ -35,7 +35,12 @@ private:
|
||||
static String _mountPoint;
|
||||
|
||||
private:
|
||||
static bool AddFileToCache(const String& siaPath, const String& cachePath)
|
||||
inline static const String& GetCacheLocation()
|
||||
{
|
||||
return _cacheLocation;
|
||||
}
|
||||
|
||||
static bool AddFileToCache(const String& siaPath, const String& cacheLocation)
|
||||
{
|
||||
bool ret = false;
|
||||
std::wstring tempPath;
|
||||
@@ -148,7 +153,7 @@ private:
|
||||
{
|
||||
String cacheFilePath;
|
||||
cacheFilePath.resize(MAX_PATH + 1);
|
||||
PathCombine(&cacheFilePath[0], _cacheLocation.c_str(), siaPath.c_str());
|
||||
PathCombine(&cacheFilePath[0], GetCacheLocation().c_str(), siaPath.c_str());
|
||||
|
||||
// If cache file already exists and is a directory, requested file operation isn't valid
|
||||
if (GetFileAttributes(cacheFilePath.c_str()) & FILE_ATTRIBUTE_DIRECTORY)
|
||||
@@ -418,10 +423,11 @@ public:
|
||||
_dokanOptions.Options |= DOKAN_OPTION_CURRENT_SESSION;
|
||||
}
|
||||
|
||||
static void Mount(const wchar_t& driveLetter)
|
||||
static void Mount(const wchar_t& driveLetter, const String& cacheLocation)
|
||||
{
|
||||
if (_siaApi && !_mountThread)
|
||||
{
|
||||
_cacheLocation = cacheLocation;
|
||||
wchar_t tmp[] = { driveLetter, ':', '\\', 0 };
|
||||
_mountPoint = tmp;
|
||||
_mountThread.reset(new std::thread([&]()
|
||||
@@ -499,12 +505,13 @@ CSiaDokanDrive::~CSiaDokanDrive()
|
||||
void CSiaDokanDrive::Mount(const wchar_t& driveLetter, const String& cacheLocation, const std::uint64_t& maxCacheSizeBytes)
|
||||
{
|
||||
std::lock_guard<std::mutex> l(DokanImpl::GetMutex());
|
||||
DokanImpl::Mount('s');
|
||||
DokanImpl::Mount(driveLetter, cacheLocation);
|
||||
}
|
||||
|
||||
void CSiaDokanDrive::Unmount(const bool& clearCache)
|
||||
{
|
||||
std::lock_guard<std::mutex> l(DokanImpl::GetMutex());
|
||||
DokanImpl::Unmount();
|
||||
}
|
||||
|
||||
void CSiaDokanDrive::ClearCache()
|
||||
|
Reference in New Issue
Block a user