Ensure backup directory exists#2441
Ensure backup directory exists#2441dail8859 wants to merge 1 commit intonotepad-plus-plus:masterfrom
Conversation
4d59574 to
431b476
Compare
| { | ||
| *p = 0; | ||
| // May or may not already exist | ||
| ::CreateDirectory(tmpName, NULL); |
There was a problem hiding this comment.
Instead calling CreateDirectory for each folder which may already exist (till ....\Roaming\Notepad++),
SHCreateDirectory can be used on fullpath. Whole logic of method createFullDirectory can be fallback option for SHCreateDirectory.
MSDN remark for SHCreateDirectory -
This function creates a file system folder whose fully qualified path is given by pszPath. If one or more of the intermediate folders do not exist, it creates them.
There was a problem hiding this comment.
I did take a look at that. However that function is located under the deprecated API...and reading the documentation for it states:
SHCreateDirectory is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions.
It did appear to work in my Win7 machine but I don't know if it works for Win8 or Win10...or how long into the future it will be supported.
There was a problem hiding this comment.
We are using these SH APIs (of course SHCreateDirectory as well) in production projects. These APIs work fine for win8 and Win10.
There was a problem hiding this comment.
That's really good to know! I'd much prefer to use SHCreateDirectory anyways. I'm never sure how serious to take the "warnings" from Microsoft about certain functions. I will update the PR when I get a chance.
Thanks!
Failed backups result in a user error message and asks to save the file anyways. Closes notepad-plus-plus#2346
431b476 to
80caad6
Compare
|
PR updated. |
* Update german.xml to version 7.0 - 14.10.16 including last updates following english.xml from 14.10.2016 Closes notepad-plus-plus#2423 * Update translations * Update farsi.xml to 7.1 * Update slovenian.xml to v7.1 * Notepad++ 7.1 release * Updated hindi.xml Closes notepad-plus-plus#2375 * Update config.model.xml * config.xml is generated by notepad++ No more config.model.xml. config.xml is generated by notepad++ directly. * Add SmartHighLight node for config.xml generation * Fixed disable smart highlihgt inconsistent behaviour This bug can be reproduce by turning off smart highlight then restart Notepad++ : some smart highlight options are still enabled. Fixes notepad-plus-plus#2442, closes notepad-plus-plus#2465 * Add .profile, .bash_profile, and .bashrc extensions. * Ensure backup directory exists Failed backups result in a user error message and asks to save the file anyways. Closes notepad-plus-plus#2346, Closes notepad-plus-plus#2441 * Add smart highlighting extension to anothe view option Add new option to enable smat highlighting extension to anothe view, while both views are visible side by side. * Fix a regression of double click on several zones of status bar. * Fix a tab settings regression Tab settings per language broken due to the entries are doubled by error during the preferences dialog reorganization. * Fix uninstaller silent mode issue Remove also unecessary files * Fix Installer for 64-bit fails with argument "/D" * Change styler to make makefile more readable Closes notepad-plus-plus#2482 * MinGW GCC update - changes necessary to get back a buildable version with mingw, last adapted with notepad-plus-plus#1229 - fixed some gcc compiler errors and warnings, see https://ci.appveyor.com/project/chcg/notepad-plus-plus/build/1.0.3 to https://ci.appveyor.com/project/chcg/notepad-plus-plus/build/1.0.13 - remaining task is the wincontrol "ReadDirectoryChanges", which uses ATL, propably not available with mingw Closes notepad-plus-plus#2478 * Japanese translation update * update translations to v7.1 * correct indent Closes notepad-plus-plus#2436 * Update Ukrainian translation Closes notepad-plus-plus#2414 * Update catalan.xml Update to v7.0 Closes notepad-plus-plus#2412 * Fix Encoding radio button issue in New Document Sync UTF-8 checkbox with UTF-8 radio button Closes notepad-plus-plus#2377 * cmake config update - added usable cmake config file by transferring files structure from visual studio project file - contains also basic support for mingw make file creation - see https://ci.appveyor.com/project/chcg/notepad-plus-plus/build/1.0.38 for successful with own appveyor config Closes notepad-plus-plus#2477 * Update translations * Notepad++ release 7.2 * Expand environment variables in backup path Fixes notepad-plus-plus#2520, Fixes notepad-plus-plus#2525 * Improve Javascript readability
* Update german.xml to version 7.0 - 14.10.16 including last updates following english.xml from 14.10.2016 Closes notepad-plus-plus#2423 * Update translations * Update farsi.xml to 7.1 * Update slovenian.xml to v7.1 * Notepad++ 7.1 release * Updated hindi.xml Closes notepad-plus-plus#2375 * Update config.model.xml * config.xml is generated by notepad++ No more config.model.xml. config.xml is generated by notepad++ directly. * Add SmartHighLight node for config.xml generation * Fixed disable smart highlihgt inconsistent behaviour This bug can be reproduce by turning off smart highlight then restart Notepad++ : some smart highlight options are still enabled. Fixes notepad-plus-plus#2442, closes notepad-plus-plus#2465 * Add .profile, .bash_profile, and .bashrc extensions. * Ensure backup directory exists Failed backups result in a user error message and asks to save the file anyways. Closes notepad-plus-plus#2346, Closes notepad-plus-plus#2441 * Add smart highlighting extension to anothe view option Add new option to enable smat highlighting extension to anothe view, while both views are visible side by side. * Fix a regression of double click on several zones of status bar. * Fix a tab settings regression Tab settings per language broken due to the entries are doubled by error during the preferences dialog reorganization. * Fix uninstaller silent mode issue Remove also unecessary files * Fix Installer for 64-bit fails with argument "/D" * Change styler to make makefile more readable Closes notepad-plus-plus#2482 * MinGW GCC update - changes necessary to get back a buildable version with mingw, last adapted with notepad-plus-plus#1229 - fixed some gcc compiler errors and warnings, see https://ci.appveyor.com/project/chcg/notepad-plus-plus/build/1.0.3 to https://ci.appveyor.com/project/chcg/notepad-plus-plus/build/1.0.13 - remaining task is the wincontrol "ReadDirectoryChanges", which uses ATL, propably not available with mingw Closes notepad-plus-plus#2478 * Japanese translation update * update translations to v7.1 * correct indent Closes notepad-plus-plus#2436 * Update Ukrainian translation Closes notepad-plus-plus#2414 * Update catalan.xml Update to v7.0 Closes notepad-plus-plus#2412 * Fix Encoding radio button issue in New Document Sync UTF-8 checkbox with UTF-8 radio button Closes notepad-plus-plus#2377 * cmake config update - added usable cmake config file by transferring files structure from visual studio project file - contains also basic support for mingw make file creation - see https://ci.appveyor.com/project/chcg/notepad-plus-plus/build/1.0.38 for successful with own appveyor config Closes notepad-plus-plus#2477 * Update translations * Notepad++ release 7.2 * Expand environment variables in backup path Fixes notepad-plus-plus#2520, Fixes notepad-plus-plus#2525 * Improved Run Macro dialog UI. 1. Radio button and edit box were overlapped 2. Edit box and comboxed were not vertically aligned.
* Update german.xml to version 7.0 - 14.10.16 including last updates following english.xml from 14.10.2016 Closes notepad-plus-plus#2423 * Update translations * Update farsi.xml to 7.1 * Update slovenian.xml to v7.1 * Notepad++ 7.1 release * Updated hindi.xml Closes notepad-plus-plus#2375 * Update config.model.xml * config.xml is generated by notepad++ No more config.model.xml. config.xml is generated by notepad++ directly. * Add SmartHighLight node for config.xml generation * Fixed disable smart highlihgt inconsistent behaviour This bug can be reproduce by turning off smart highlight then restart Notepad++ : some smart highlight options are still enabled. Fixes notepad-plus-plus#2442, closes notepad-plus-plus#2465 * Add .profile, .bash_profile, and .bashrc extensions. * Ensure backup directory exists Failed backups result in a user error message and asks to save the file anyways. Closes notepad-plus-plus#2346, Closes notepad-plus-plus#2441 * Add smart highlighting extension to anothe view option Add new option to enable smat highlighting extension to anothe view, while both views are visible side by side. * Fix a regression of double click on several zones of status bar. * Fix a tab settings regression Tab settings per language broken due to the entries are doubled by error during the preferences dialog reorganization. * Fix uninstaller silent mode issue Remove also unecessary files * Fix Installer for 64-bit fails with argument "/D" * Change styler to make makefile more readable Closes notepad-plus-plus#2482 * MinGW GCC update - changes necessary to get back a buildable version with mingw, last adapted with notepad-plus-plus#1229 - fixed some gcc compiler errors and warnings, see https://ci.appveyor.com/project/chcg/notepad-plus-plus/build/1.0.3 to https://ci.appveyor.com/project/chcg/notepad-plus-plus/build/1.0.13 - remaining task is the wincontrol "ReadDirectoryChanges", which uses ATL, propably not available with mingw Closes notepad-plus-plus#2478 * Japanese translation update * update translations to v7.1 * correct indent Closes notepad-plus-plus#2436 * Update Ukrainian translation Closes notepad-plus-plus#2414 * Update catalan.xml Update to v7.0 Closes notepad-plus-plus#2412 * Fix Encoding radio button issue in New Document Sync UTF-8 checkbox with UTF-8 radio button Closes notepad-plus-plus#2377 * cmake config update - added usable cmake config file by transferring files structure from visual studio project file - contains also basic support for mingw make file creation - see https://ci.appveyor.com/project/chcg/notepad-plus-plus/build/1.0.38 for successful with own appveyor config Closes notepad-plus-plus#2477 * Update translations * Notepad++ release 7.2 * Expand environment variables in backup path Fixes notepad-plus-plus#2520, Fixes notepad-plus-plus#2525 * Update readme.txt * Improve Javascript string readability Fixes notepad-plus-plus#1543, closes notepad-plus-plus#2550 * Small tune on Run Macro dialog UI. 1. Radio button and edit box were overlapped 2. Edit box and comboxed were not vertically aligned. Closes notepad-plus-plus#2549 * Remove 32bit shell dll from 64bit installer Closes notepad-plus-plus#2408
Failed backups result in a user error message and asks to save the file anyways. Closes notepad-plus-plus#2346, Closes notepad-plus-plus#2441
Failed backups result in a user error message and asks to save the file anyways. Closes notepad-plus-plus#2346, Closes notepad-plus-plus#2441
Closes #2346
The root cause of #2346 is a non-existing directory, and then the function returned false which aborted the save. This addresses the issue along with a few other tweaks:
CreateDirectory()is not sufficient since multiple sub folders may not exist.fileSave()when figuring out where to save backups.The new error message looks like this: