From b3d35b27df1ddee1263925d1a7b3760f84825b1e Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Sun, 17 May 2020 22:53:48 +0100 Subject: [PATCH] [misc] add _mkdirExU and _rmdirU to msapi_utf8.h --- src/msapi_utf8.h | 38 ++++++++++++++++++++++++++++++++++++++ src/rufus.rc | 10 +++++----- 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/src/msapi_utf8.h b/src/msapi_utf8.h index 1f1f64fc..3e7e20da 100644 --- a/src/msapi_utf8.h +++ b/src/msapi_utf8.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -1072,6 +1073,43 @@ static __inline int _mkdirU(const char* dirname) return ret; } +// This version of _mkdirU creates all needed directories along the way +static __inline int _mkdirExU(const char* dirname) +{ + int ret = -1, trailing_slash = -1; + size_t i, len; + wconvert(dirname); + len = wcslen(wdirname); + while (trailing_slash && (len > 0)) { + if ((wdirname[len - 1] == '\\') || (wdirname[len - 1] == '/')) + wdirname[--len] = 0; + else + trailing_slash = 0; + } + for (i = 0; i < len; i++) + if ((wdirname[i] == '\\') || (wdirname[i] == '/')) + wdirname[i] = 0; + for (i = 0; i < len; ) { + if ((_wmkdir(wdirname) < 0) && (errno != EEXIST) && (errno != EACCES)) + goto out; + i = wcslen(wdirname); + wdirname[i] = '\\'; + } + ret = 0; +out: + wfree(dirname); + return ret; +} + +static __inline int _rmdirU(const char* dirname) +{ + wconvert(dirname); + int ret; + ret = _wrmdir(wdirname); + wfree(dirname); + return ret; +} + // The following expects PropertyBuffer to contain a single Unicode string static __inline BOOL SetupDiGetDeviceRegistryPropertyU(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, PDWORD PropertyRegDataType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize) diff --git a/src/rufus.rc b/src/rufus.rc index ea8ba780..c71c70fb 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -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 3.10.1654" +CAPTION "Rufus 3.10.1655" FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP @@ -395,8 +395,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,10,1654,0 - PRODUCTVERSION 3,10,1654,0 + FILEVERSION 3,10,1655,0 + PRODUCTVERSION 3,10,1655,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -414,13 +414,13 @@ BEGIN VALUE "Comments", "https://rufus.ie" VALUE "CompanyName", "Akeo Consulting" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "3.10.1654" + VALUE "FileVersion", "3.10.1655" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2020 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" VALUE "OriginalFilename", "rufus-3.10.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "3.10.1654" + VALUE "ProductVersion", "3.10.1655" END END BLOCK "VarFileInfo"