Sublime Forum

Windows froze; now text file is 0kb

#1

My operating system frozeup while I was working on some code in sublime for a game-engine, so I was ctrl+s’ing every minute or two to show the changes in the engine (the engine shouldn’t be connected at all to the issue, all work was being done in sublime itself, the engine just loads from the file location).

I restarted the computer and when I loaded up sublime again the file I was editing was empty and now showing 0kb with nothing in it completely blank. Is my file saved somewhere as a backup session I can access? The other files I had been working in alongside it are still intact. This file though was of course the big file and the last backup was a week ago.
Is there a file I can go to and loadup the previous saved sessions? I know alot of applications have multiple sessions of a file ur working on saved automatically. I can’t find anything of such. I am on windows.

When I loaded up sublime it automatically loads the previous session which is where I noticed the file was blank. I also keep getting “error trying to prase settings: expected string in packages/user/autofoldcode.sublime-settings:321135:1” in my other files.

I don’t want to keep mucking around blindly incase I am overwriting the save status of the previous session. I am very upset by this as it seemingly implies I cannot work on anything without the risk of it re-saving itself as an empty file.

0 Likes

#2

We do keep backup sessions, though these only contain unsaved file changes. They’re located in %APPDATA%\Sublime Text\Local. Session.sublime_session is the main session file.

You may have more luck with a data recovery program; though be aware that the more you use your drive the less likely that data is still around.

0 Likes

#3

That’s just the previous session. What data can I extract from that? Isn’t that what automatically opens when I re-open sublime? The file in question opened, as an empty 0kb file. That’s the only safety net? How does this even happen?

0 Likes

#4

As I said Sublime Text stores files with unsaved changes in the session, so potentially the entire file. The session is saved periodically.

The file in question opened, as an empty 0kb file. That’s the only safety net? How does this even happen?

This can happen if Windows decides to flush the file being truncated to disk before writing the new contents but then crashes before writing the new content. There’s also various other ways data can be lost when a system crashes including hardware failure.

We do have an undocumented "atomic_save" option that can mitigate that first possible cause, but it causes numerous other issues (see https://stackoverflow.com/questions/20634684/what-is-sublime-text-doing-when-i-save-a-file).

0 Likes