Disk (Windows): make / an alias of C:\ for --disk-folders

This commit is contained in:
李通洲
2024-05-01 15:52:38 +08:00
parent 8af88a3376
commit 982e8a0117
2 changed files with 9 additions and 1 deletions
+2 -1
View File
@@ -947,7 +947,8 @@
},
{
"long": "disk-folders",
"desc": "A colon (semicolon on Windows) separated list of folder paths for the disk output",
"desc": "A colon (semicolon on Windows) separated list of folder paths to be detected",
"remark": "On Windows, a drive latter must be upper cased and end with \"\\\". \"/\" is used as an alias of the system drive. eg. \"/\" is the alias of \"C:\\\".",
"arg": {
"type": "path",
"default": "Auto detection using mount-points"
+7
View File
@@ -15,6 +15,13 @@ const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks)
FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate();
// For cross-platform portability; used by `presets/examples/13.jsonc`
if (__builtin_expect(options->folders.length == 1 && options->folders.chars[0] == '/', 0))
{
ffStrbufSetS(&options->folders, getenv("SystemDrive"));
ffStrbufEnsureEndsWithC(&options->folders, '\\');
}
for(uint32_t i = 0; i < length; i++)
{
wchar_t* mountpoint = buf + i;