Skip to content

Commit 21e602f

Browse files
authored
Merge pull request adobe#614 from adobe/master
Merge master into release branch for 1.10 release
2 parents 539e3e4 + 14a0758 commit 21e602f

19 files changed

+1510
-172
lines changed

Gruntfile.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ module.exports = function (grunt) {
7171
"dest" : "<%= downloads %>",
7272
"src" : "http://nodejs.org/dist/v<%= node.version %>/node-v<%= node.version %>-darwin-x64.tar.gz"
7373
},
74+
"icu-mac": {
75+
"dest" : "<%= downloads %>",
76+
"src" : "<%= icu.url %>/icu_<%= icu.version %>_macosx64.zip"
77+
},
7478
/* win */
7579
"cef-win": {
7680
"dest" : "<%= downloads %>",
@@ -83,6 +87,10 @@ module.exports = function (grunt) {
8387
"node-win": {
8488
"dest" : "<%= downloads %>",
8589
"src" : "http://nodejs.org/dist/v<%= node.version %>/win-x86/node.exe"
90+
},
91+
"icu-win": {
92+
"dest" : "<%= downloads %>",
93+
"src" : "<%= icu.url %>/icu_<%= icu.version %>_windows32.zip"
8694
}
8795
},
8896
"clean": {
@@ -112,6 +120,9 @@ module.exports = function (grunt) {
112120
"devtools_resources.pak",
113121
"icudtl.dat",
114122
"libcef.dll",
123+
"icuuc58.dll",
124+
"icuin58.dll",
125+
"icudt58.dll",
115126
"natives_blob.bin",
116127
"snapshot_blob.bin",
117128
"command/**"
@@ -202,6 +213,10 @@ module.exports = function (grunt) {
202213
"cef": {
203214
"src" : "<%= cef_zip %>",
204215
"dest" : "deps/cef"
216+
},
217+
"icu": {
218+
"src" : "<%= icu_zip %>",
219+
"dest" : "deps/icu"
205220
}
206221
},
207222
"eslint": {
@@ -234,6 +249,10 @@ module.exports = function (grunt) {
234249
},
235250
"node": {
236251
"version" : "6.3.1"
252+
},
253+
"icu": {
254+
"url" : "http://s3.amazonaws.com/files.brackets.io/icu",
255+
"version" : "58"
237256
}
238257
});
239258

appshell.gyp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
],
5555
'include_dirs': [
5656
'.',
57+
'deps/icu/include',
5758
],
5859
'sources': [
5960
'<@(includes_common)',
@@ -130,6 +131,8 @@
130131
'-lshell32.lib',
131132
'-lole32.lib',
132133
'-lgdi32.lib',
134+
'-ldeps/icu/lib/icuin.lib',
135+
'-ldeps/icu/lib/icuuc.lib',
133136
'-l$(ConfigurationName)/libcef.lib',
134137
],
135138
},
@@ -169,6 +172,11 @@
169172
# Copy windows command line script
170173
'destination': '<(PRODUCT_DIR)command',
171174
'files': ['scripts/brackets.bat', 'scripts/brackets'],
175+
},
176+
{
177+
# Copy ICU dlls
178+
'destination': '<(PRODUCT_DIR)',
179+
'files': ['deps/icu/bin/icuuc58.dll', 'deps/icu/bin/icuin58.dll', 'deps/icu/bin/icudt58.dll'],
172180
}
173181
],
174182
}],
@@ -270,6 +278,9 @@
270278
'$(SDKROOT)/System/Library/Frameworks/ScriptingBridge.framework',
271279
'$(SDKROOT)/System/Library/Frameworks/Security.framework',
272280
'$(CONFIGURATION)/<(framework_name).framework/<(framework_name)',
281+
'deps/icu/lib/libicuuc.a',
282+
'deps/icu/lib/libicui18n.a',
283+
'deps/icu/lib/libicudata.a',
273284
],
274285
},
275286
'sources': [
@@ -457,6 +468,7 @@
457468
],
458469
'include_dirs': [
459470
'.',
471+
'deps/icu/include',
460472
],
461473
'link_settings': {
462474
'libraries': [

appshell/appshell_extensions.cpp

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,31 +304,36 @@ class ProcessMessageDelegate : public ClientHandler::ProcessMessageDelegate {
304304
ExtensionString filename = argList->GetString(1);
305305
ExtensionString encoding = argList->GetString(2);
306306
std::string contents = "";
307+
bool preserveBOM = false;
307308

308-
error = ReadFile(filename, encoding, contents);
309+
error = ReadFile(filename, encoding, contents, preserveBOM);
309310

310311
// Set response args for this function
311312
responseArgs->SetString(2, contents);
313+
responseArgs->SetString(3, encoding);
314+
responseArgs->SetBool(4, preserveBOM);
312315
}
313316
} else if (message_name == "WriteFile") {
314317
// Parameters:
315318
// 0: int32 - callback id
316319
// 1: string - filename
317320
// 2: string - data
318321
// 3: string - encoding
319-
if (argList->GetSize() != 4 ||
322+
if (argList->GetSize() != 5 ||
320323
argList->GetType(1) != VTYPE_STRING ||
321324
argList->GetType(2) != VTYPE_STRING ||
322-
argList->GetType(3) != VTYPE_STRING) {
325+
argList->GetType(3) != VTYPE_STRING ||
326+
argList->GetType(4) != VTYPE_BOOL) {
323327
error = ERR_INVALID_PARAMS;
324328
}
325329

326330
if (error == NO_ERROR) {
327331
ExtensionString filename = argList->GetString(1);
328332
std::string contents = argList->GetString(2);
329333
ExtensionString encoding = argList->GetString(3);
334+
bool preserveBOM = argList->GetBool(4);
330335

331-
error = WriteFile(filename, contents, encoding);
336+
error = WriteFile(filename, contents, encoding, preserveBOM);
332337
// No additional response args for this function
333338
}
334339
} else if (message_name == "SetPosixPermissions") {
@@ -636,6 +641,9 @@ class ProcessMessageDelegate : public ClientHandler::ProcessMessageDelegate {
636641
bool enabled = argList->GetBool(2);
637642
bool checked = argList->GetBool(3);
638643
error = NativeMenuModel::getInstance(getMenuParent(browser)).setMenuItemState(command, enabled, checked);
644+
if (error == NO_ERROR) {
645+
error = SetMenuItemState(browser, command, enabled, checked);
646+
}
639647
}
640648
} else if (message_name == "SetMenuTitle") {
641649
// Parameters:
@@ -752,7 +760,13 @@ class ProcessMessageDelegate : public ClientHandler::ProcessMessageDelegate {
752760
error = InstallCommandLineTools();
753761
}
754762

755-
} else {
763+
} else if (message_name == "GetMachineHash") {
764+
// Parameters:
765+
// 0: int32 - callback id
766+
767+
responseArgs->SetString(2, GetSystemUniqueID());
768+
}
769+
else {
756770
fprintf(stderr, "Native function not implemented yet: %s\n", message_name.c_str());
757771
return false;
758772
}

appshell/appshell_extensions.js

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,21 @@ if (!appshell.app) {
7070
* @constant An unsupported encoding value was specified.
7171
*/
7272
appshell.fs.ERR_UNSUPPORTED_ENCODING = 5;
73+
74+
/**
75+
* @constant File could not be encoded.
76+
*/
77+
appshell.fs.ERR_ENCODE_FILE_FAILED = 18;
78+
79+
/**
80+
* @constant File could not be decoded.
81+
*/
82+
appshell.fs.ERR_DECODE_FILE_FAILED = 19;
83+
84+
/**
85+
* @constant File was encoded with utf-16
86+
*/
87+
appshell.fs.ERR_UNSUPPORTED_UTF16_ENCODING = 20;
7388

7489
/**
7590
* @constant File could not be written.
@@ -394,8 +409,8 @@ if (!appshell.app) {
394409
* @return None. This is an asynchronous call that sends all return information to the callback.
395410
*/
396411
native function WriteFile();
397-
appshell.fs.writeFile = function (path, data, encoding, callback) {
398-
WriteFile(callback || _dummyCallback, path, data, encoding);
412+
appshell.fs.writeFile = function (path, data, encoding, preserveBOM, callback) {
413+
WriteFile(callback || _dummyCallback, path, data, encoding, preserveBOM);
399414
};
400415

401416
/**
@@ -863,13 +878,26 @@ if (!appshell.app) {
863878
*
864879
* @param {number}
865880
*
866-
* @return int. The remote debugging port used by the appshell.
881+
* @return none.
867882
*/
868883
native function InstallCommandLineTools();
869884
appshell.app.installCommandLine = function (callback) {
870885
InstallCommandLineTools(callback);
871886
};
872-
887+
888+
/**
889+
* Get hash of the machine based on various parameters like
890+
* network interfaces, CPU ID, volume serial number e.t.c
891+
*
892+
* @param {none}
893+
*
894+
* @return None. This is an asynchronous call that sends all return information to the callback.
895+
*/
896+
native function GetMachineHash();
897+
appshell.app.getMachineHash = function (callback) {
898+
GetMachineHash(callback || _dummyCallback);
899+
};
900+
873901

874902
// Alias the appshell object to brackets. This is temporary and should be removed.
875903
brackets = appshell;

0 commit comments

Comments
 (0)