зеркало из https://github.com/mozilla/brackets.git
Load extensions from the application support directory.
This commit is contained in:
Родитель
6a262f4365
Коммит
bb8ad847d4
|
@ -2,10 +2,10 @@ Thumbs.db
|
||||||
src/brackets.css
|
src/brackets.css
|
||||||
src/brackets.min.css
|
src/brackets.min.css
|
||||||
|
|
||||||
# ignore everything in the user extension directory EXCEPT the README
|
# ignore everything in the dev extension directory EXCEPT the README
|
||||||
# (so that the directory is non-empty and can be in git)
|
# (so that the directory is non-empty and can be in git)
|
||||||
src/extensions/user/*
|
src/extensions/dev/*
|
||||||
!src/extensions/user/README
|
!src/extensions/dev/README
|
||||||
|
|
||||||
#OSX .DS_Store files
|
#OSX .DS_Store files
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
|
@ -110,16 +110,44 @@ define(function (require, exports, module) {
|
||||||
require("search/FindReplace");
|
require("search/FindReplace");
|
||||||
require("utils/ExtensionUtils");
|
require("utils/ExtensionUtils");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the full path of the default user extensions directory. This is in the users
|
||||||
|
* application support directory, which is typically:
|
||||||
|
* /Users/<user>/Application Support/Brackets/extensions/user on the mac
|
||||||
|
* C:\Users\<user>\AppData\Roaming\Brackets\extensions\user on windows.
|
||||||
|
*/
|
||||||
|
function _getUserExtensionPath() {
|
||||||
|
return brackets.app.getApplicationSupportDirectory() + "/extensions/user";
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: (issue 1029) Add timeout to main extension loading promise, so that we always call this function
|
// TODO: (issue 1029) Add timeout to main extension loading promise, so that we always call this function
|
||||||
// Making this fix will fix a warning (search for issue 1029) related to the global brackets 'ready' event.
|
// Making this fix will fix a warning (search for issue 1029) related to the global brackets 'ready' event.
|
||||||
function _initExtensions() {
|
function _initExtensions() {
|
||||||
// allow unit tests to override which plugin folder(s) to load
|
// allow unit tests to override which plugin folder(s) to load
|
||||||
var paths = params.get("extensions") || "default,user";
|
var paths = params.get("extensions");
|
||||||
|
|
||||||
|
if (!paths) {
|
||||||
|
paths = "default,dev," + _getUserExtensionPath();
|
||||||
|
}
|
||||||
|
|
||||||
return Async.doInParallel(paths.split(","), function (item) {
|
return Async.doInParallel(paths.split(","), function (item) {
|
||||||
|
var extensionPath,
|
||||||
|
relativePath;
|
||||||
|
|
||||||
|
// If the item has "/" in it, assume it is a full path. Otherwise, load
|
||||||
|
// from our source path + "/extensions/".
|
||||||
|
if (item.indexOf("/") === -1) {
|
||||||
|
extensionPath = FileUtils.getNativeBracketsDirectoryPath() + "/extensions/" + item;
|
||||||
|
relativePath = "extensions/" + item;
|
||||||
|
} else {
|
||||||
|
extensionPath = item;
|
||||||
|
relativePath = PathUtils.makePathRelative(extensionPath,
|
||||||
|
FileUtils.getNativeBracketsDirectoryPath() + "/");
|
||||||
|
}
|
||||||
|
|
||||||
return ExtensionLoader.loadAllExtensionsInNativeDirectory(
|
return ExtensionLoader.loadAllExtensionsInNativeDirectory(
|
||||||
FileUtils.getNativeBracketsDirectoryPath() + "/extensions/" + item,
|
extensionPath,
|
||||||
"extensions/" + item
|
relativePath
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -242,6 +270,16 @@ define(function (require, exports, module) {
|
||||||
ProjectManager.openProject(initialProjectPath).always(function () {
|
ProjectManager.openProject(initialProjectPath).always(function () {
|
||||||
_initTest();
|
_initTest();
|
||||||
|
|
||||||
|
// Create a new DirectoryEntry and call getDirectory() on the user extension
|
||||||
|
// directory. If the directory doesn't exist, it will be created.
|
||||||
|
// Note that this is an async call and there are no success or failure functions passed
|
||||||
|
// in. If the directory *doesn't* exist, it will be created. Extension loading may happen
|
||||||
|
// before the directory is finished being created, but that is okay, since the extension
|
||||||
|
// loading will work correctly without this directory.
|
||||||
|
// If the directory *does* exist, nothing else needs to be done. It will be scanned normally
|
||||||
|
// during extension loading.
|
||||||
|
new NativeFileSystem.DirectoryEntry().getDirectory(_getUserExtensionPath(), {create: true});
|
||||||
|
|
||||||
// WARNING: AppInit.appReady won't fire if ANY extension fails to
|
// WARNING: AppInit.appReady won't fire if ANY extension fails to
|
||||||
// load or throws an error during init. To fix this, we need to
|
// load or throws an error during init. To fix this, we need to
|
||||||
// make a change to _initExtensions (filed as issue 1029)
|
// make a change to _initExtensions (filed as issue 1029)
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
This directory contains extensions that are being developed. User-installed
|
||||||
|
extensions are placed in the "user" extensions directory, which can be accessed
|
||||||
|
by running the _Help > Show Extensions Folder_ menu command. The contents of
|
||||||
|
this directory (except the README file) are ignored by git.
|
||||||
|
|
||||||
|
(README also serves as a dummy file so this directory can be added to git.)
|
|
@ -1,4 +0,0 @@
|
||||||
This directory contains extensions enabled by the user. The contents of
|
|
||||||
this directory (except the README file) are ignored by git.
|
|
||||||
|
|
||||||
(README also serves as a dummy file so this directory can be added to git.)
|
|
|
@ -39,8 +39,8 @@ define(function (require, exports, module) {
|
||||||
Async = require("utils/Async"),
|
Async = require("utils/Async"),
|
||||||
contexts = {},
|
contexts = {},
|
||||||
globalConfig = {
|
globalConfig = {
|
||||||
"text" : "../../../thirdparty/text",
|
"text" : FileUtils.getNativeBracketsDirectoryPath() + "/thirdparty/text",
|
||||||
"i18n" : "../../../thirdparty/i18n"
|
"i18n" : FileUtils.getNativeBracketsDirectoryPath() + "/thirdparty/i18n"
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Загрузка…
Ссылка в новой задаче