Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 90bf018

Browse files
committed
Merge pull request #7398 from adobe/dangoor/7374-path-subfolder
Fix for #7374 project prefs path breaking project open.
2 parents c4116a7 + a779dbe commit 90bf018

3 files changed

Lines changed: 31 additions & 18 deletions

File tree

.brackets.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
"src/thirdparty/CodeMirror2/**/*.js": {
1212
"spaceUnits": 2,
1313
"linting.enabled": false
14+
},
15+
"src/thirdparty/globmatch.js": {
16+
"spaceUnits": 2,
17+
"linting.enabled": false
1418
}
1519
},
1620
"spaceUnits": 4,

src/project/ProjectManager.js

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,20 @@ define(function (require, exports, module) {
10751075
return result.promise();
10761076
}
10771077

1078+
/**
1079+
* @private
1080+
* Reloads the project preferences.
1081+
*/
1082+
function _reloadProjectPreferencesScope() {
1083+
var root = getProjectRoot();
1084+
if (root) {
1085+
// Alias the "project" Scope to the path Scope for the project-level settings file
1086+
PreferencesManager._setProjectSettingsFile(root.fullPath + SETTINGS_FILENAME);
1087+
} else {
1088+
PreferencesManager._setProjectSettingsFile();
1089+
}
1090+
}
1091+
10781092
/**
10791093
* Loads the given folder as a project. Normally, you would call openProject() instead to let the
10801094
* user choose a folder.
@@ -1154,15 +1168,16 @@ define(function (require, exports, module) {
11541168
_projectRoot.fullPath !== rootEntry.fullPath;
11551169
var i;
11561170

1157-
if (projectRootChanged) {
1158-
PreferencesManager._setCurrentEditingFile(rootPath);
1159-
}
1160-
1161-
11621171
// Success!
11631172
var perfTimerName = PerfUtils.markStart("Load Project: " + rootPath);
11641173

11651174
_projectRoot = rootEntry;
1175+
1176+
if (projectRootChanged) {
1177+
_reloadProjectPreferencesScope();
1178+
PreferencesManager._setCurrentEditingFile(rootPath);
1179+
}
1180+
11661181
_projectBaseUrl = PreferencesManager.getViewState("project.baseUrl", context) || "";
11671182
_allFilesCachePromise = null; // invalidate getAllFiles() cache as soon as _projectRoot changes
11681183

@@ -2267,18 +2282,6 @@ define(function (require, exports, module) {
22672282
"projectBaseUrl_": "user"
22682283
}, true, _checkPreferencePrefix);
22692284

2270-
function _reloadProjectPreferencesScope() {
2271-
var root = getProjectRoot();
2272-
if (root) {
2273-
// Alias the "project" Scope to the path Scope for the project-level settings file
2274-
PreferencesManager._setProjectSettingsFile(root.fullPath + SETTINGS_FILENAME);
2275-
} else {
2276-
PreferencesManager._setProjectSettingsFile();
2277-
}
2278-
}
2279-
2280-
$(exports).on("projectOpen", _reloadProjectPreferencesScope);
2281-
22822285
// Initialize the sort prefixes and make sure to change them when the sort pref changes
22832286
_generateSortPrefixes();
22842287
PreferencesManager.on("change", "sortDirectoriesFirst", function () {

src/thirdparty/globmatch.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ module.exports = fnmatch;
1414
minimatch.Minimatch = Minimatch;
1515

1616
function fnmatch(filepath, glob) {
17-
var matchOptions = {matchBase: true, dot: true, noext: true};
17+
var matchOptions = {dot: true, noext: true};
18+
19+
// brackets #7374: don't try to match base if a directory name is passed in
20+
if (filepath[filepath.length - 1] !== "/") {
21+
matchOptions.matchBase = true;
22+
}
23+
1824
glob = glob.replace(/\*\*/g, '{*,**/**/**}');
1925
return minimatch(filepath, glob, matchOptions);
2026
};

0 commit comments

Comments
 (0)