-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New FileSystem API #5797
New FileSystem API #5797
Changes from 205 commits
f73b6ed
26c31d3
4a4471c
619dd45
714732b
1fa9144
cb6b986
5fcf425
bf68b86
868e45b
13368c4
8a56cee
045f346
6be82be
89d1dbc
543e122
0089986
848e0b6
819a208
65f69aa
ba93b48
45899bb
c89ae3f
ce74bc8
eaca879
ada68e2
490ce52
1cacf78
1c1fb62
3cdcfb4
6a9b2d0
0d2b8d5
d5f3259
599755c
b252859
b124d1b
d93a85e
5237004
4d362dd
3035dca
6df65b9
b5248bf
daec4a2
b10bb35
2640846
e0e4f4d
da95b3a
e8be7c0
b08d0d1
f451101
5352487
b1ad00c
8705bbb
29ad888
a3b5e70
88283d9
9ffe75f
996ea0d
d0cb127
fb2c451
8269ff1
af57cff
087a451
9dc6a18
5d8394d
c5d15eb
c5bafcf
af80be7
6f01dfe
333bb13
8050678
89945f8
266cdaa
b060e8f
94f3f4d
444fbb0
93a276c
53992af
a91c32c
ca5820f
1d815b9
f5e8269
466e044
1c8f5a1
d091932
634ab02
9576a8c
413fe4f
290da88
a29d37b
931e8d3
e142295
fa0171d
eff3422
00b315a
bfb113d
387eb81
bd967ff
26c792c
4ab1a60
0d32066
5e7bd59
cee12e8
9f2578d
80fa112
3ad103c
8403184
892a808
202da51
3ba67f5
ec16c64
7756ce1
654c984
e2a3a15
276c403
89cda23
8ae8dc5
8fdc8d0
df26c44
98954da
fa70a26
181278c
e53bbfb
955c6d3
2ab57c0
63f452e
d3e0b2d
35a6cc0
8c60a81
a88bbff
af54c57
94a9cb8
e0ebe14
f8c86db
d6e2486
858e452
ea9196d
8066e30
eb49314
ab3cb48
b21ae30
354a838
54527b6
2ecc22f
173442c
67c19d0
400ed27
e9a5a6b
c5279bc
dd69c94
980acaf
992bdaa
3e67b04
4a0929e
04e4c6c
70c9453
ddb3500
84c0e1c
d2723a4
b2bd648
2362dd8
b7a8372
4cddefc
3eac55a
ac5adc5
0942969
e33f78b
507a5c0
0cb5182
fa8c824
998f619
bc831b9
f04b2d2
c073637
004ff69
79335bd
3dde788
34085c5
2184802
779019d
13562ee
5967e2f
7561f75
7c1a450
ce60edc
92ea58b
7bff28e
cc52b50
af294e1
d1b698c
4d6c73d
0fd2e14
dffad5f
629bc8f
4d83481
b34a1a3
1b626bd
453f472
7b5042e
d77cf16
7595fdc
3280c1d
6cbe02c
b5e5da5
609d873
60c8cd0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,7 +76,7 @@ define(function (require, exports, module) { | |
CommandManager = require("command/CommandManager"), | ||
CodeHintManager = require("editor/CodeHintManager"), | ||
PerfUtils = require("utils/PerfUtils"), | ||
FileIndexManager = require("project/FileIndexManager"), | ||
FileSystem = require("filesystem/FileSystem"), | ||
QuickOpen = require("search/QuickOpen"), | ||
Menus = require("command/Menus"), | ||
FileUtils = require("file/FileUtils"), | ||
|
@@ -89,7 +89,6 @@ define(function (require, exports, module) { | |
Async = require("utils/Async"), | ||
UpdateNotification = require("utils/UpdateNotification"), | ||
UrlParams = require("utils/UrlParams").UrlParams, | ||
NativeFileSystem = require("file/NativeFileSystem").NativeFileSystem, | ||
PreferencesManager = require("preferences/PreferencesManager"), | ||
Resizer = require("utils/Resizer"), | ||
LiveDevelopmentMain = require("LiveDevelopment/main"), | ||
|
@@ -114,8 +113,17 @@ define(function (require, exports, module) { | |
require("extensibility/InstallExtensionDialog"); | ||
require("extensibility/ExtensionManagerDialog"); | ||
|
||
// Compatibility shims for filesystem API migration | ||
require("project/FileIndexManager"); | ||
require("file/NativeFileSystem"); | ||
require("file/NativeFileError"); | ||
|
||
PerfUtils.addMeasurement("brackets module dependencies resolved"); | ||
|
||
|
||
// Initialize the file system | ||
FileSystem.init(require("filesystem/impls/appshell/AppshellFileSystem")); | ||
|
||
// Local variables | ||
var params = new UrlParams(); | ||
|
||
|
@@ -141,7 +149,7 @@ define(function (require, exports, module) { | |
JSUtils : JSUtils, | ||
CommandManager : CommandManager, | ||
FileSyncManager : FileSyncManager, | ||
FileIndexManager : FileIndexManager, | ||
FileSystem : FileSystem, | ||
Menus : Menus, | ||
KeyBindingManager : KeyBindingManager, | ||
CodeHintManager : CodeHintManager, | ||
|
@@ -162,6 +170,7 @@ define(function (require, exports, module) { | |
RemoteAgent : require("LiveDevelopment/Agents/RemoteAgent"), | ||
HTMLInstrumentation : require("language/HTMLInstrumentation"), | ||
MultiRangeInlineEditor : require("editor/MultiRangeInlineEditor").MultiRangeInlineEditor, | ||
LanguageManager : LanguageManager, | ||
doneLoading : false | ||
}; | ||
|
||
|
@@ -172,7 +181,7 @@ define(function (require, exports, module) { | |
|
||
function _onReady() { | ||
PerfUtils.addMeasurement("window.document Ready"); | ||
|
||
EditorManager.setEditorHolder($("#editor-holder")); | ||
|
||
// Let the user know Brackets doesn't run in a web browser yet | ||
|
@@ -223,12 +232,14 @@ define(function (require, exports, module) { | |
if (!params.get("skipSampleProjectLoad") && !prefs.getValue("afterFirstLaunch")) { | ||
prefs.setValue("afterFirstLaunch", "true"); | ||
if (ProjectManager.isWelcomeProjectPath(initialProjectPath)) { | ||
var dirEntry = new NativeFileSystem.DirectoryEntry(initialProjectPath); | ||
|
||
dirEntry.getFile("index.html", {}, function (fileEntry) { | ||
var promise = CommandManager.execute(Commands.FILE_ADD_TO_WORKING_SET, { fullPath: fileEntry.fullPath }); | ||
promise.then(deferred.resolve, deferred.reject); | ||
}, deferred.reject); | ||
FileSystem.resolve(initialProjectPath + "index.html", function (err, file) { | ||
if (!err) { | ||
var promise = CommandManager.execute(Commands.FILE_ADD_TO_WORKING_SET, { fullPath: file.fullPath }); | ||
promise.then(deferred.resolve, deferred.reject); | ||
} else { | ||
deferred.reject(); | ||
} | ||
}); | ||
} else { | ||
deferred.resolve(); | ||
} | ||
|
@@ -333,8 +344,9 @@ define(function (require, exports, module) { | |
|
||
// TODO: (issue 269) to support IE, need to listen to document instead (and even then it may not work when focus is in an input field?) | ||
$(window).focus(function () { | ||
// This call to syncOpenDocuments() *should* be a no-op now that we have | ||
// file watchers, but is still here as a safety net. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment is a bit ahead of itself since we haven't yet added file watchers. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider it a tease, or optimism, or both... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like we could actually remove this whole listener now, though -- the wholesale FileSystem "change" event sent on window focus covers this 100% already. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unless we think we'd want this back (explicitly check 'important' files) when watchers are reintroduced and the fake change event gets turned off... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I think this should be kept in as a "safety net" in case watchers get unreliable. It may be redundant, but seems worth it for the extra safety. |
||
FileSyncManager.syncOpenDocuments(); | ||
FileIndexManager.markDirty(); | ||
}); | ||
|
||
// Prevent unhandled middle button clicks from triggering native behavior | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to understand what you had in mind: I guess file system should be loaded before the global object is constructed, so that it would make decisions based on whether FileSystem has been initialized instead of presence of brackets.fs. Perhaps, Global.js should expose an explicit init() which could be called from within bracket.js instead of initializing on module load as it is done now. Is it something along the lines of your thinking?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There will always be some filesystem (else Brackets will be 100% broken), so nothing useful that Globals could determine by looking at that alone. The inBrowser flag shouldn't really be about what type of filesystem impl you're using anyway -- see my response in the forum thread for my thoughts there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @peterflynn mentioned, the
inBrowser
check and file system initialization are separate items.However, we should not be hard-coding the file system impl/init() in this file. At minimum, this should be factored into a separate file. It would be nice if the impl could be declared in a config file (along with other inBrowser-related features). I filed #5869 for tracking.