Skip to content

Commit

Permalink
fix for external editor in storyboarder spec for clip studio pro
Browse files Browse the repository at this point in the history
  • Loading branch information
setpixel committed Dec 6, 2017
1 parent 007f13f commit d22dd34
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
3 changes: 3 additions & 0 deletions src/js/files/file-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ let writePhotoshopFileFromPNGPathLayers = (pngPathLayers, psdPath, options) => {
curCanvas.width = curLayerImg.width
curCanvas.height = curLayerImg.height
context.drawImage(curLayerImg, 0, 0)
// hack
context.fillStyle = 'rgba(0,0,0,0.1)'
context.fillRect(0,0, 1, 1)
child.canvas = curCanvas
psdWidth = curLayerImg.width > psdWidth ? curLayerImg.width : psdWidth
psdHeight = curLayerImg.height > psdHeight ? curLayerImg.height : psdHeight
Expand Down
20 changes: 7 additions & 13 deletions src/js/window/main-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -1730,27 +1730,21 @@ let openInEditor = async () => {
let pathToEditor = prefsModule.getPrefs()['absolutePathToImageEditor']
if (pathToEditor) {
let binaryPath
let execString

// use .exe directly on win32
if (pathToEditor.match(/\.exe$/)) {
binaryPath = pathToEditor

execString = `"${binaryPath}" "${pathToLinkedFile}"`
// find binary in .app package on macOS
} else if (pathToEditor.match(/\.app$/)) {
try {
let obj = plist.parse(fs.readFileSync(path.join(pathToEditor, 'Contents', 'Info.plist'), 'utf8'))
if (obj.CFBundlePackageType === 'APPL') {
binaryPath = path.join(pathToEditor, 'Contents', 'MacOS', obj.CFBundleExecutable)
} else {
errmsg = 'Not a valid .app package'
}
} catch (err) {
errmsg = 'Could not find executable binary in .app'
}
} else if (pathToEditor.match(/\.app$/)) {
binaryPath = pathToEditor
execString = `open -a "${binaryPath}" "${pathToLinkedFile}"`
}

if (binaryPath) {
child_process.exec(`"${binaryPath}" ${pathToLinkedFile}`, (error, stdout, stderr) => {
child_process.exec(execString, (error, stdout, stderr) => {
console.log(execString)
if (error) {
notifications.notify({ message: `[WARNING] ${error}` })
return
Expand Down

0 comments on commit d22dd34

Please sign in to comment.