Try to mount
This commit is contained in:
@@ -592,6 +592,7 @@ UploadError CUploadManager::AddOrUpdate(const String& siaPath, String filePath)
|
|||||||
{
|
{
|
||||||
// Strip drive specification (i.e. C:\)
|
// Strip drive specification (i.e. C:\)
|
||||||
// TODO If mount to folder is ever enabled, this will need to change
|
// 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 siaDriveFileName = GenerateSha256(&filePath[3]) + L".siadrive";
|
||||||
|
|
||||||
String siaDriveFilePath;
|
String siaDriveFilePath;
|
||||||
|
@@ -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.
|
// 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;
|
// 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.
|
// 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:
|
private:
|
||||||
typedef struct
|
typedef struct
|
||||||
@@ -436,12 +436,13 @@ public:
|
|||||||
if (_siaApi && !_mountThread)
|
if (_siaApi && !_mountThread)
|
||||||
{
|
{
|
||||||
_cacheLocation = cacheLocation;
|
_cacheLocation = cacheLocation;
|
||||||
wchar_t tmp[] = { driveLetter, ':', '\\', 0 };
|
wchar_t tmp[] = { driveLetter, ':', 0 };
|
||||||
_mountPoint = tmp;
|
_mountPoint = tmp;
|
||||||
_mountThread.reset(new std::thread([&]()
|
_mountThread.reset(new std::thread([&]()
|
||||||
{
|
{
|
||||||
_dokanOptions.MountPoint = _mountPoint.c_str();
|
_dokanOptions.MountPoint = _mountPoint.c_str();
|
||||||
_mountStatus = DokanMain(&_dokanOptions, &_dokanOps);
|
_mountStatus = DokanMain(&_dokanOptions, &_dokanOps);
|
||||||
|
OutputDebugString(std::to_wstring(_mountStatus).c_str());
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include "../SiaDrive.Dokan.Api/SiaDokanDrive.h"
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define new DEBUG_NEW
|
#define new DEBUG_NEW
|
||||||
@@ -206,17 +207,19 @@ HRESULT CSiaDriveDlg::OnButtonUnlockWallet(IHTMLElement* /*pElement*/)
|
|||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
Dokan::CSiaDokanDrive* d;
|
||||||
void CSiaDriveDlg::OnDocumentComplete(LPDISPATCH, LPCTSTR)
|
void CSiaDriveDlg::OnDocumentComplete(LPDISPATCH, LPCTSTR)
|
||||||
{
|
{
|
||||||
KillTimer(IDT_UPDATE);
|
KillTimer(IDT_UPDATE);
|
||||||
KillTimer(IDT_UI_ACTION_QUEUE);
|
KillTimer(IDT_UI_ACTION_QUEUE);
|
||||||
|
|
||||||
// Create new API to clear all cached data used by threaded implementations
|
// 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();
|
ClearDisplay();
|
||||||
CallClientScript(L"setAvailableDrives", json(GetAvailableDrives()), nullptr);
|
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_UPDATE, 2000, nullptr);
|
||||||
SetTimer(IDT_UI_ACTION_QUEUE, 100, nullptr);
|
SetTimer(IDT_UI_ACTION_QUEUE, 100, nullptr);
|
||||||
|
Reference in New Issue
Block a user