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

Commit 2dea43e

Browse files
author
Nitesh Kumar
committed
updating preferences file with default app
1 parent 52e9414 commit 2dea43e

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/extensions/default/OpenWithExternalApplication/GraphicsFile.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ define(function (require, exports, module) {
3636
_initialized = false;
3737

3838
var _graphicsFileTypes = ["jpg", "jpeg", "png", "svg", "xd", "psd", "ai"];
39-
//var _graphicsFileTypes = [ "psd"];
4039

4140
var _nodeDomain;
4241

@@ -104,12 +103,29 @@ define(function (require, exports, module) {
104103
}
105104

106105
brackets.app.getSystemDefaultApp(_graphicsFileTypes.join(), function (err, out) {
106+
107+
if(err) {
108+
return;
109+
}
107110
var associateApp = out.split(','),
108111
fileTypeToAppMap = {};
109112

110113
associateApp.forEach(function(item) {
111-
fileTypeToAppMap[item.split(':')[0]] = item.split(':')[1];
114+
fileTypeToAppMap[item.split('##')[0]] = item.split('##')[1];
112115
});
116+
117+
var prefs = PreferencesManager.get('externalApplications');
118+
119+
for (var key in fileTypeToAppMap) {
120+
if (fileTypeToAppMap.hasOwnProperty(key)) {
121+
if(key && !prefs[key]) {
122+
prefs[key] = "default";
123+
}
124+
}
125+
}
126+
127+
PreferencesManager.set('externalApplications', prefs);
128+
113129
Dialogs.showModalDialog(
114130
DefaultDialogs.DIALOG_ID_INFO,
115131
Strings.ASSOCIATE_GRAPHICS_FILE_TO_DEFAULT_APP_TITLE,

0 commit comments

Comments
 (0)