Cygwin, use correct mount point

This commit is contained in:
benrubson 2018-03-26 22:26:44 +02:00
parent 27394cd198
commit e8e1dc3595
2 changed files with 23 additions and 2 deletions

View File

@ -72,6 +72,7 @@ enum ConfigMode { Config_Prompt, Config_Standard, Config_Paranoia };
struct EncFS_Opts {
std::string rootDir;
std::string mountPoint; // where to make filesystem visible
std::string cygDrive; // Cygwin mount drive
bool createIfNotFound; // create filesystem if not found
bool idleTracking; // turn on idle monitoring of filesystem
bool mountOnDemand; // mounting on-demand

View File

@ -542,18 +542,38 @@ static bool processArgs(int argc, char *argv[],
if (!isDirectory(out->opts->rootDir.c_str()) &&
!userAllowMkdir(out->opts->annotate ? 1 : 0, out->opts->rootDir.c_str(),
0700)) {
cerr << _("Unable to locate root directory, aborting.");
cerr << _("Unable to locate root directory, aborting.") << endl;
return false;
}
#ifdef __CYGWIN__
if (isDirectory(out->opts->mountPoint.c_str())) {
cerr << _("Mount point must not exist before mouting, aborting.") << endl;
return false;
}
if ((strncmp(out->opts->mountPoint.c_str(), "/cygdrive/", 10) != 0) ||
(out->opts->mountPoint.length() != 12)) {
cerr << _("A drive is prefered for mouting, ")
<< _("so a path like /cygdrive/x should rather be used. ")
<< _("Mounting anyway.") << endl;
}
#else
if (!isDirectory(out->opts->mountPoint.c_str()) &&
!userAllowMkdir(out->opts->annotate ? 2 : 0,
out->opts->mountPoint.c_str(), 0700)) {
cerr << _("Unable to locate mount point, aborting.");
cerr << _("Unable to locate mount point, aborting.") << endl;
return false;
}
#endif
// fill in mount path for fuse
out->fuseArgv[1] = out->opts->mountPoint.c_str();
#ifdef __CYGWIN__
if ((strncmp(out->opts->mountPoint.c_str(), "/cygdrive/", 10) == 0) &&
(out->opts->mountPoint.length() == 12)) {
out->opts->cygDrive = out->opts->mountPoint.substr(10,1).append(":");
out->fuseArgv[1] = out->opts->cygDrive.c_str();
}
#endif
return true;
}