1
0

Try to mount

This commit is contained in:
Scott E. Graves
2017-03-01 00:18:37 -06:00
parent f55b3ccba9
commit bc04e8d6d1
3 changed files with 9 additions and 4 deletions

View File

@@ -592,6 +592,7 @@ UploadError CUploadManager::AddOrUpdate(const String& siaPath, String filePath)
{
// Strip drive specification (i.e. C:\)
// TODO If mount to folder is ever enabled, this will need to change
// TODO Case sensative file names? Going to be a bit of an issue.
String siaDriveFileName = GenerateSha256(&filePath[3]) + L".siadrive";
String siaDriveFilePath;

View File

@@ -10,7 +10,7 @@ using namespace Sia::Api::Dokan;
// Files requested to be openned that are not cached will be downloaded first. If the file is not found in Sia, it will be treated as new.
// Keeping cache and Sia in synch will be a bit of a hastle, so it's strongly suggested to treat the cache folder as if it doesn't exist;
// however, simply deleting files in the cache folder should not be an issue as long as the drive is not mounted.
class DokanImpl
class AFX_EXT_CLASS DokanImpl
{
private:
typedef struct
@@ -436,12 +436,13 @@ public:
if (_siaApi && !_mountThread)
{
_cacheLocation = cacheLocation;
wchar_t tmp[] = { driveLetter, ':', '\\', 0 };
wchar_t tmp[] = { driveLetter, ':', 0 };
_mountPoint = tmp;
_mountThread.reset(new std::thread([&]()
{
_dokanOptions.MountPoint = _mountPoint.c_str();
_mountStatus = DokanMain(&_dokanOptions, &_dokanOps);
OutputDebugString(std::to_wstring(_mountStatus).c_str());
}));
}
}

View File

@@ -9,6 +9,7 @@
#include <stdbool.h>
#include <bitset>
#include <thread>
#include "../SiaDrive.Dokan.Api/SiaDokanDrive.h"
#ifdef _DEBUG
#define new DEBUG_NEW
@@ -206,17 +207,19 @@ HRESULT CSiaDriveDlg::OnButtonUnlockWallet(IHTMLElement* /*pElement*/)
return S_OK;
}
Dokan::CSiaDokanDrive* d;
void CSiaDriveDlg::OnDocumentComplete(LPDISPATCH, LPCTSTR)
{
KillTimer(IDT_UPDATE);
KillTimer(IDT_UI_ACTION_QUEUE);
// Create new API to clear all cached data used by threaded implementations
_siaApi.reset(new CSiaApi({ L"localhost", 9980, L"1.1.0" }, &_siaConfig));
_siaApi.reset(new CSiaApi({ L"localhost", 9980, L"1.1.1" }, &_siaConfig));
ClearDisplay();
CallClientScript(L"setAvailableDrives", json(GetAvailableDrives()), nullptr);
d = new Dokan::CSiaDokanDrive(*_siaApi, &_siaConfig);
d->Mount('A', CA2W(_siaConfig.GetCacheFolder().c_str()).m_psz, 10);
SetTimer(IDT_UPDATE, 2000, nullptr);
SetTimer(IDT_UI_ACTION_QUEUE, 100, nullptr);