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

Commit

Permalink
Merge pull request #614 from adobe/master
Browse files Browse the repository at this point in the history
Merge master into release branch for 1.10 release
  • Loading branch information
saurabh95 authored Jul 3, 2017
2 parents 539e3e4 + 14a0758 commit 21e602f
Show file tree
Hide file tree
Showing 19 changed files with 1,510 additions and 172 deletions.
19 changes: 19 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ module.exports = function (grunt) {
"dest" : "<%= downloads %>",
"src" : "http://nodejs.org/dist/v<%= node.version %>/node-v<%= node.version %>-darwin-x64.tar.gz"
},
"icu-mac": {
"dest" : "<%= downloads %>",
"src" : "<%= icu.url %>/icu_<%= icu.version %>_macosx64.zip"
},
/* win */
"cef-win": {
"dest" : "<%= downloads %>",
Expand All @@ -83,6 +87,10 @@ module.exports = function (grunt) {
"node-win": {
"dest" : "<%= downloads %>",
"src" : "http://nodejs.org/dist/v<%= node.version %>/win-x86/node.exe"
},
"icu-win": {
"dest" : "<%= downloads %>",
"src" : "<%= icu.url %>/icu_<%= icu.version %>_windows32.zip"
}
},
"clean": {
Expand Down Expand Up @@ -112,6 +120,9 @@ module.exports = function (grunt) {
"devtools_resources.pak",
"icudtl.dat",
"libcef.dll",
"icuuc58.dll",
"icuin58.dll",
"icudt58.dll",
"natives_blob.bin",
"snapshot_blob.bin",
"command/**"
Expand Down Expand Up @@ -202,6 +213,10 @@ module.exports = function (grunt) {
"cef": {
"src" : "<%= cef_zip %>",
"dest" : "deps/cef"
},
"icu": {
"src" : "<%= icu_zip %>",
"dest" : "deps/icu"
}
},
"eslint": {
Expand Down Expand Up @@ -234,6 +249,10 @@ module.exports = function (grunt) {
},
"node": {
"version" : "6.3.1"
},
"icu": {
"url" : "http://s3.amazonaws.com/files.brackets.io/icu",
"version" : "58"
}
});

Expand Down
12 changes: 12 additions & 0 deletions appshell.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
],
'include_dirs': [
'.',
'deps/icu/include',
],
'sources': [
'<@(includes_common)',
Expand Down Expand Up @@ -130,6 +131,8 @@
'-lshell32.lib',
'-lole32.lib',
'-lgdi32.lib',
'-ldeps/icu/lib/icuin.lib',
'-ldeps/icu/lib/icuuc.lib',
'-l$(ConfigurationName)/libcef.lib',
],
},
Expand Down Expand Up @@ -169,6 +172,11 @@
# Copy windows command line script
'destination': '<(PRODUCT_DIR)command',
'files': ['scripts/brackets.bat', 'scripts/brackets'],
},
{
# Copy ICU dlls
'destination': '<(PRODUCT_DIR)',
'files': ['deps/icu/bin/icuuc58.dll', 'deps/icu/bin/icuin58.dll', 'deps/icu/bin/icudt58.dll'],
}
],
}],
Expand Down Expand Up @@ -270,6 +278,9 @@
'$(SDKROOT)/System/Library/Frameworks/ScriptingBridge.framework',
'$(SDKROOT)/System/Library/Frameworks/Security.framework',
'$(CONFIGURATION)/<(framework_name).framework/<(framework_name)',
'deps/icu/lib/libicuuc.a',
'deps/icu/lib/libicui18n.a',
'deps/icu/lib/libicudata.a',
],
},
'sources': [
Expand Down Expand Up @@ -457,6 +468,7 @@
],
'include_dirs': [
'.',
'deps/icu/include',
],
'link_settings': {
'libraries': [
Expand Down
24 changes: 19 additions & 5 deletions appshell/appshell_extensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,31 +304,36 @@ class ProcessMessageDelegate : public ClientHandler::ProcessMessageDelegate {
ExtensionString filename = argList->GetString(1);
ExtensionString encoding = argList->GetString(2);
std::string contents = "";
bool preserveBOM = false;

error = ReadFile(filename, encoding, contents);
error = ReadFile(filename, encoding, contents, preserveBOM);

// Set response args for this function
responseArgs->SetString(2, contents);
responseArgs->SetString(3, encoding);
responseArgs->SetBool(4, preserveBOM);
}
} else if (message_name == "WriteFile") {
// Parameters:
// 0: int32 - callback id
// 1: string - filename
// 2: string - data
// 3: string - encoding
if (argList->GetSize() != 4 ||
if (argList->GetSize() != 5 ||
argList->GetType(1) != VTYPE_STRING ||
argList->GetType(2) != VTYPE_STRING ||
argList->GetType(3) != VTYPE_STRING) {
argList->GetType(3) != VTYPE_STRING ||
argList->GetType(4) != VTYPE_BOOL) {
error = ERR_INVALID_PARAMS;
}

if (error == NO_ERROR) {
ExtensionString filename = argList->GetString(1);
std::string contents = argList->GetString(2);
ExtensionString encoding = argList->GetString(3);
bool preserveBOM = argList->GetBool(4);

error = WriteFile(filename, contents, encoding);
error = WriteFile(filename, contents, encoding, preserveBOM);
// No additional response args for this function
}
} else if (message_name == "SetPosixPermissions") {
Expand Down Expand Up @@ -636,6 +641,9 @@ class ProcessMessageDelegate : public ClientHandler::ProcessMessageDelegate {
bool enabled = argList->GetBool(2);
bool checked = argList->GetBool(3);
error = NativeMenuModel::getInstance(getMenuParent(browser)).setMenuItemState(command, enabled, checked);
if (error == NO_ERROR) {
error = SetMenuItemState(browser, command, enabled, checked);
}
}
} else if (message_name == "SetMenuTitle") {
// Parameters:
Expand Down Expand Up @@ -752,7 +760,13 @@ class ProcessMessageDelegate : public ClientHandler::ProcessMessageDelegate {
error = InstallCommandLineTools();
}

} else {
} else if (message_name == "GetMachineHash") {
// Parameters:
// 0: int32 - callback id

responseArgs->SetString(2, GetSystemUniqueID());
}
else {
fprintf(stderr, "Native function not implemented yet: %s\n", message_name.c_str());
return false;
}
Expand Down
36 changes: 32 additions & 4 deletions appshell/appshell_extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,21 @@ if (!appshell.app) {
* @constant An unsupported encoding value was specified.
*/
appshell.fs.ERR_UNSUPPORTED_ENCODING = 5;

/**
* @constant File could not be encoded.
*/
appshell.fs.ERR_ENCODE_FILE_FAILED = 18;

/**
* @constant File could not be decoded.
*/
appshell.fs.ERR_DECODE_FILE_FAILED = 19;

/**
* @constant File was encoded with utf-16
*/
appshell.fs.ERR_UNSUPPORTED_UTF16_ENCODING = 20;

/**
* @constant File could not be written.
Expand Down Expand Up @@ -394,8 +409,8 @@ if (!appshell.app) {
* @return None. This is an asynchronous call that sends all return information to the callback.
*/
native function WriteFile();
appshell.fs.writeFile = function (path, data, encoding, callback) {
WriteFile(callback || _dummyCallback, path, data, encoding);
appshell.fs.writeFile = function (path, data, encoding, preserveBOM, callback) {
WriteFile(callback || _dummyCallback, path, data, encoding, preserveBOM);
};

/**
Expand Down Expand Up @@ -863,13 +878,26 @@ if (!appshell.app) {
*
* @param {number}
*
* @return int. The remote debugging port used by the appshell.
* @return none.
*/
native function InstallCommandLineTools();
appshell.app.installCommandLine = function (callback) {
InstallCommandLineTools(callback);
};


/**
* Get hash of the machine based on various parameters like
* network interfaces, CPU ID, volume serial number e.t.c
*
* @param {none}
*
* @return None. This is an asynchronous call that sends all return information to the callback.
*/
native function GetMachineHash();
appshell.app.getMachineHash = function (callback) {
GetMachineHash(callback || _dummyCallback);
};


// Alias the appshell object to brackets. This is temporary and should be removed.
brackets = appshell;
Expand Down
Loading

0 comments on commit 21e602f

Please sign in to comment.