[cmd] fix the use of relative paths with option -i

* Closes #2232
This commit is contained in:
Pete Batard 2023-04-23 13:06:32 +01:00
parent 3177e70e25
commit a354178239
No known key found for this signature in database
GPG Key ID: 38E0CF5E69EDD671
2 changed files with 16 additions and 11 deletions

View File

@ -3498,14 +3498,19 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
// No need to reprocess that option
break;
case 'i':
if (_access(optarg, 0) != -1) {
safe_free(image_path);
image_path = calloc(1, MAX_PATH);
if (image_path == NULL)
break;
IGNORE_RETVAL(_chdirU(app_dir));
IGNORE_RETVAL(GetFullPathNameU(optarg, MAX_PATH, image_path, NULL));
// FILE_ATTRIBUTE_DIRECTORY is set for both dir and access error
if (GetFileAttributesU(image_path) & FILE_ATTRIBUTE_DIRECTORY) {
printf("Could not find image '%s'\n", image_path);
safe_free(image_path);
image_path = safe_strdup(optarg);
img_provided = TRUE;
}
else {
printf("Could not find ISO image '%s'\n", optarg);
break;
}
img_provided = TRUE;
break;
case 'l':
if (isdigitU(optarg[0])) {

View File

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 4.0.2029"
CAPTION "Rufus 4.0.2030"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -392,8 +392,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,0,2029,0
PRODUCTVERSION 4,0,2029,0
FILEVERSION 4,0,2030,0
PRODUCTVERSION 4,0,2030,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -411,13 +411,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "4.0.2029"
VALUE "FileVersion", "4.0.2030"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2023 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-4.0.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "4.0.2029"
VALUE "ProductVersion", "4.0.2030"
END
END
BLOCK "VarFileInfo"