Default Save location



  • Hello,

    I tried to stet this to my default Save location in the Preferences (extract from the config file):

    <GUIConfig name=“openSaveDir” value=“2” defaultDirPath="%userprofile%\Desktop" />

    I close and reopen Notepad++. I create a new file, type something, hit “Save” and still it does not bring me to the desktop. However, if I just open up the Settings > Preference dialog, then Save again, it offers the Desktop.

    Does anyone have the same issue ? How should I always want to save to the desktop and be prompted with that location first ?

    Thanks a lot !



  • @Wim-Gielis ,

    It works for me.

    What version of Notepad++ (? menu, Debug Info, copy, then paste in your reply)

    Also, did you confirm that the changes to config.xml were made in the right config.xml? The Debug Info will help you find that: if Local Conf Mode is OFF, then the right config.xml will be %AppData%\Notepad++\config.xml; if that mode is ON, then it will be <install path>\config.xml (where <install path> is the directory holding notepad++.exe).

    Also, did you confirm that the changes to config.xml were properly saved? You can verify this by exiting Notepad++ and coming back in, and loading up config.xml and making sure the changes are still there. Please note that Notepad++ overwrites config.xml when it exits, so if even if you follow the Editing Config Files best-practices (as published today, Jun 6 2021), if you use Notepad++ to edit config.xml, you will lose your changes. (FYI: the online manual is being changed, to indicate that unlike other configuration files for Notepad++, you have to use a different editor for config.xml (like MS Win’s builtin notepad.exe, or maybe a separate portable copy of Notepad++ that doesn’t use the same config.xml). This will be in the next update of the website.)

    When I make the change externally and use <GUIConfig name="openSaveDir" value="2" defaultDirPath="%userprofile%\Desktop" />, the next time I open Notepad++, File > New then File > Save As will default to my Desktop, File > Open will default to the Desktop, and Settings > Preferences > Default Directory confirms %userprofile%\Desktop as the default location:
    c19afb24-c3ee-4ed5-8a69-683699bce924-image.png

    Further, if you just manually pick your desktop in Settings > Preferences > Default Directory, and then exit Notepad++ and come back in, it will keep your pick, and will still open or save-as from the Desktop; on my system, the setting looks like the following screenshot after closing and re-running Notepad++:
    8ee029f5-82f1-47fd-8f92-0d0973da0dae-image.png

    (All of these experiments were done with v7.9.5-64bit, but that logic hasn’t been changed in my recent memory, so it should work the same for most recent versions, including v8.0-RC3.)



  • Thank you very much Peter, that is a lot of information.
    I will reply back after my working day.



  • There was a bug when the Default Directory setting wasn’t remembered:
    https://github.com/notepad-plus-plus/notepad-plus-plus/issues/9767
    It has been fixed in v8.



  • Thank you mere-human, I have exactly the same as in the post you linked to. Many thanks and I guess this topic can be closed.



  • Well, too quick I think.
    I upgraded to version 8 64 bits. I create a new file, typ 1 letter, hit Ctrl-s and it defaults to the Notepad++ location. Notepad++ was already closed and restarted and the path in the settings is correct: %userprofile%\Desktop



  • @Wim-Gielis said in Default Save location:

    I upgraded to version 8 64 bits. I create a new file, typ 1 letter, hit Ctrl-s and it defaults to the Notepad++ location. Notepad++ was already closed and restarted and the path in the settings is correct: %userprofile%\Desktop

    Works for me.
    Is it time for you to post your Debug Info (from the ? menu)?
    (As I see now, previously requested by Peter)



  • Apologies, I must have missed that request.

    Notepad++ v8 (64-bit)
    Build time : Jun 6 2021 - 18:38:25
    Path : C:\Program Files\Notepad++\notepad++.exe
    Command Line :
    Admin mode : OFF
    Local Conf mode : OFF
    Cloud Config : OFF
    OS Name : Windows 10 Enterprise (64-bit)
    OS Version : 1909
    OS Build : 18363.1082
    Current ANSI codepage : 1252
    Plugins : ComparePlugin.dll HTMLTag.dll mimeTools.dll NppConverter.dll NppExec.dll NppExport.dll NPPJSONViewer.dll NppSaveAsAdmin.dll PythonScript.dll qkNppReverseLines.dll QuickText.dll Remove Duplicate Lines.dll XMLTools.dll



  • @Wim-Gielis ,

    Maybe try running Notepad++ with the -noPlugin command-line-argument – it’s doubtful, but maybe one of your plugins is messing up that feature.

    If you go to Settings > Preferences > Default Directory, if you click on the ... button, it should pop up your %userprofile%\Desktop directory; if you hit Save, it should come back and the path in that entry should now have expanded to your actual userprofile directory (something like my example c:\Users\Peter\Desktop shown in my screenshot above).

    If it didn’t, that might mean that for some reason, Notepad++ cannot convert your %userprofile%\Desktop to an actual directory name (maybe there is some strange character, or it’s not properly defined?).

    OTOH, if it does convert after the ... and save, does the feature of using that as default directory for saving and opening work on this instance? What about if you exit and re-start? If it works with the explicit directory name, then it would strengthen the argument that something in your value of %userprofile% is confusing Notepad++. (But I will reiterate that my %userprofile% variable works just fine.)

    Because whatever I try, if I have the entry set to a literal directory or a %variable%-including name, it will always use that directory as the default for open/save-as when I have that option enabled.

    And today, instead of v7.9.5, I am using v8. So multiple versions, I still cannot replicate your results.

    Notepad++ v8   (64-bit)
    Build time : Jun  6 2021 - 18:38:25
    Path : C:\usr\local\apps\npp\npp.8.0.portable.x64\notepad++.exe
    Command Line : 
    Admin mode : OFF
    Local Conf mode : ON
    Cloud Config : OFF
    OS Name : Windows 10 Enterprise (64-bit) 
    OS Version : 1903
    OS Build : 18362.1256
    Current ANSI codepage : 1252
    Plugins : mimeTools.dll NppConverter.dll NppExport.dll 
    


  • Hi Peter,

    -noPlugin does not help, same results. I see no plugins indeed, confirming that the no-Plugin command worked.

    Clicking on the ellipsis, the D: drive comes up. In the box I have %userprofile%\Desktop, still D: shows up.

    If I ctrl-o in Notepad++ and paste %userprofile%\Desktop, it goes to to the desktop. It could indicate that Notepad++ finds no issues with translating the %path% path to a literal path.

    “f you hit Save, it should come back and the path in that entry should now have expanded to your actual userprofile directory (something like my example c:\Users\Peter\Desktop shown in my screenshot above).”
    ==> it translated to: D:\OneDrive\OneDrive - Aexis NV\Bureaublad (Bueaublad is Dutch for desktop)

    After that, hitting Save brings me to the Desktop, which is good ! Also after restart. The icing on the cake would be to be able to use %userprofile%\Desktop, such that if I copy my config.xml file to a remote computer, it would also default to the desktop there :-)

    Could OneDrive be causing an issue ?



  • @Wim-Gielis said in Default Save location:

    Could OneDrive be causing an issue ?

    If OneDrive were intermittently not letting Notepad++ see that directory, then Notepad++ might just ignore that setting…

    I have OneDriveForBusiness at work; when I set %SpacedVariable% to my one-drive folder, then set <GUIConfig name="openSaveDir" value="2" defaultDirPath="%SpacedFolder%" />, then started Notepad++ v8.0-64bit, it works as expected, with Notepad++ defaulting to my OneDriveForBusiness folder (which, like you, has spaces and hyphens in it) for both SaveAs and Open operations.

    I don’t know why your instance is having trouble interpreting the %userprofile% variable correctly.

    The icing on the cake would be to be able to use %userprofile%\Desktop, such that if I copy my config.xml file to a remote computer, it would also default to the desktop there

    Unfortunately, I am not sure that you are going to be able to ice that cake, due to your current setup having strange difficulties with that variable.



  • Indeed, a strange behavior but thanks for the confirmation anyway.



  • Works for me in Notepad++ v8.
    My guess is that %userprofile% is invalid at some point.
    @Wim-Gielis Did you try absolute path?

    Also, what of your configs are stored in OneDrive folder? This one or something different?
    5790e5b1-7d23-401f-a837-19845922afae-image.png

    Maybe at some point, the folder is locked because of the OneDrive sync which could be the problem.


Log in to reply