Skip to content

Commit

Permalink
fix: add dmask fmask when mount device
Browse files Browse the repository at this point in the history
only for vfat/ntfs/exfat fs. make the mountpoint share in different
users

Log: as above.

Change-Id: Iffc0315f65edc3d605b9cc730f799e181c0d2494
  • Loading branch information
itsXuSt committed Jan 3, 2025
1 parent 7378168 commit 23d44e4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/dfm-base/base/device/devicemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,15 @@ void DeviceManager::mountBlockDevAsync(const QString &id, const QVariantMap &opt
return;
}

QVariantMap options = opts;
const QStringList winFS { "ntfs", "vfat", "exfat" };
if (winFS.contains(dev->fileSystem())) {
auto optStr = options.value("options").toString();
optStr.prepend("dmask=000,fmask=111,");
if (optStr.endsWith(",")) optStr.chop(1);
options.insert("options", optStr);
}

if (dev->optical()) {
if (d->isMountingOptical) {
qCWarning(logDFMBase) << "Currently mounting a disc!";
Expand All @@ -193,7 +202,7 @@ void DeviceManager::mountBlockDevAsync(const QString &id, const QVariantMap &opt
connect(fw, &QFutureWatcher<void>::finished, this, [=]() {
qCInfo(logDFMBase) << "query optical item info finished, about to starting mounting it...";
d->isMountingOptical = false;
dev->mountAsync(opts, callback);
dev->mountAsync(options, callback);
delete fw;
});
d->isMountingOptical = true;
Expand Down Expand Up @@ -236,7 +245,7 @@ void DeviceManager::mountBlockDevAsync(const QString &id, const QVariantMap &opt
retryMount(id, DeviceType::kBlockDevice, timeout + 1); // if device not mounted, mount it again
}
};
dev->mountAsync(opts, callback);
dev->mountAsync(options, callback);
} else {
qCWarning(logDFMBase) << "device is not mountable: " << errMsg << id;
if (cb)
Expand Down

0 comments on commit 23d44e4

Please sign in to comment.