How does npp persist and restore files that were opened between startup?



  • This is a question about the source code. I’ve asked around about how to persist application data and the general response has been:

    1. Write data to a file (plaintext, serialization)
    2. Write data to a database

    I wanted to know how and where (what source code file/method) NPP handles persistence. Nevermind the question of what I’m trying to do. I’m just interested in how it’s implemented in this text editor.

    One example where I think persistence is used is to open files that were previously closed when the user exits npp. The names of those files must be saved somewhere and execution must know where to look to get the names of those files to reload them when npp is restored.

    I’ve downloaded the source code for npp from github but there are a lot of files to go through. It’d help if you can point me to the right folder/source code/method, etc.



  • @ElusiveTau said in How does npp persist and restore files that were opened between startup?:

    persistence is used is to open files that were previously closed when the user exits npp. The names of those files must be saved somewhere

    session.xml

    but there are a lot of files to go through. It’d help if you can point me to…

    Like everybody else that is interested, you have to just dig in.



  • @Alan-Kilborn Thanks Alan. For posterity this mentions it’s on the AppData path.



  • @ElusiveTau

    But it isn’t always on the “appdata” path. I could be located in the same folder as notepad++.exe is! In fact, that’s my preferred place for it.


Log in to reply