Skip to content

Commit 607389a

Browse files
committed
docs: update FileRecovery file docs
1 parent 73a0222 commit 607389a

3 files changed

Lines changed: 26 additions & 1 deletion

File tree

src/extensions/default/NavigationAndHistory/FileRecovery.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,30 @@
2121

2222
/*global path, logger, jsPromise*/
2323

24+
/**
25+
* This file outlines the process phcode follows to restore files if the application crashes or if a user closes
26+
* the application without saving their files.
27+
*
28+
* For each project in phcode, there's a unique 'restore' folder located in the appdata directory.
29+
* This folder is named according to the pattern <projectName>-<projectPathHash>.
30+
*
31+
* The restore folder monitors all files being edited in phcode, and this tracking is updated every 5 seconds
32+
* by a function called changeScanner. The function backs up changes every 5 seconds, and only unsaved files
33+
* that have been modified since the last backup are synced again. When files are saved, they're removed from
34+
* the backup during this changeScanner process because there's no need to restore them.
35+
*
36+
* When opening a project, we first check for the existence of a 'restore' folder associated with that project
37+
* and scan for any files within it. If we find any, these files are marked for potential restoration.
38+
*
39+
* During this process, we load all recoverable file data into memory and temporarily halt any writing activity
40+
* to the 'restore' folder. This safeguard is in place to prevent any accidental overwriting of the restore files'
41+
* data in case the user edits any files currently marked for restoration.
42+
*
43+
* Once we've cached the data from the restore files, we present a notification to the user, asking if they would
44+
* like these files to be restored. If the user agrees, we then open all of these files in the editor and populate
45+
* them with the previously cached, restored content.
46+
*/
47+
2448
define(function (require, exports, module) {
2549
const NativeApp = brackets.getModule("utils/NativeApp"),
2650
FileSystem = brackets.getModule("filesystem/FileSystem"),

src/extensions/default/NavigationAndHistory/html/recovery-template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
data-project="{{PROJECT_TO_RECOVER}}"
88
onclick="EventManager.triggerEvent('ph-recovery', 'restoreProject', this.getAttribute('data-project'))"
99
>
10-
Restore
10+
{{Strings.RECOVER_UNSAVED_FILES_RESTORE}}
1111
</button>
1212
</div>

src/nls/root/strings.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,7 @@ define({
797797
"RECENT_FILES_DLG_CLEAR_BUTTON_TITLE": "Clear files not in Working Set",
798798
"RECOVER_UNSAVED_FILES_TITLE": "Recover Unsaved Files?",
799799
"RECOVER_UNSAVED_FILES_MESSAGE": "Restore unsaved files from your previous session?",
800+
"RECOVER_UNSAVED_FILES_RESTORE": "Restore",
800801

801802
// Descriptions of core preferences
802803
"DESCRIPTION_CLOSE_BRACKETS": "true to automatically close braces, brackets and parentheses",

0 commit comments

Comments
 (0)