Skip to content

Commit feeacb5

Browse files
committed
FUSE - Add removable drive option and use local drive as default type now.
1 parent 094d53b commit feeacb5

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

dokan_fuse/include/dokanfuse.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ struct fuse_config
3333
int readonly;
3434
int setsignals;
3535
unsigned int timeoutInSec;
36+
int removableDrive;
3637
int networkDrive;
3738
unsigned long allocationUnitSize;
3839
unsigned long sectorSize;

dokan_fuse/src/dokanfuse.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -505,12 +505,16 @@ int do_fuse_loop(struct fuse *fs, bool mt) {
505505
if (fs->conf.mountManager)
506506
dokanOptions->Options |= DOKAN_OPTION_MOUNT_MANAGER;
507507
else {
508-
dokanOptions->Options |=
509-
fs->conf.networkDrive ? DOKAN_OPTION_NETWORK : DOKAN_OPTION_REMOVABLE;
510-
wchar_t uncName[MAX_PATH + 1];
511-
if (fs->conf.networkDrive && fs->conf.uncname) {
512-
mbstowcs(uncName, fs->conf.uncname, MAX_PATH);
513-
dokanOptions->UNCName = uncName;
508+
if (fs->conf.removableDrive) {
509+
dokanOptions->Options |= DOKAN_OPTION_REMOVABLE;
510+
}
511+
if (fs->conf.networkDrive) {
512+
dokanOptions->Options |= DOKAN_OPTION_NETWORK;
513+
wchar_t uncName[MAX_PATH + 1];
514+
if (fs->conf.networkDrive && fs->conf.uncname) {
515+
mbstowcs(uncName, fs->conf.uncname, MAX_PATH);
516+
dokanOptions->UNCName = uncName;
517+
}
514518
}
515519
}
516520

@@ -607,6 +611,7 @@ static const struct fuse_opt fuse_lib_opts[] = {
607611
FUSE_LIB_OPT("sector_size=%lu", sectorSize, 0),
608612
FUSE_LIB_OPT("-n", networkDrive, 1),
609613
FUSE_LIB_OPT("-m", mountManager, 1),
614+
FUSE_LIB_OPT("-p", removableDrive, 1),
610615
FUSE_OPT_END};
611616

612617
static void fuse_lib_help(void) {
@@ -624,6 +629,7 @@ static void fuse_lib_help(void) {
624629
" -o sector_size=M set sector size\n"
625630
" -n use network drive\n"
626631
" -m use mount manager\n"
632+
" -p use removable drive\n"
627633
"\n");
628634
}
629635

0 commit comments

Comments
 (0)