Cerebro: Cerebro unable to find plugin sources

Created on 17 Aug 2017  路  4Comments  路  Source: cerebroapp/cerebro

  • [x] I am on the latest Cerebro.app version
  • [x] I have searched the issues of this repo and believe that this is not a duplicate
  • macOS Sierra:
  • 0.3.0:
  • Uncaught Error: ENOENT: no such file or directory, open '//scripts/customfile.ext' _(See above how to open it)_:

Issue


I am trying to use https://www.npmjs.com/package/node-osascript in order to execute commands on MacOS, single commands work great, where things break is when I need to feed the path to an external file that needs to be processed and executed.

osascript.executeFile('path/to/script.scpt', { varName : 'value'}, function(err, result, raw){
  if (err) return console.error(err)
    console.log(result, raw)
});

using __dirname from node, the root directory is evaluated as such / which may be OK in some instances but after looking more in depth at the application osascript can't find the file provided. However, if I feed manually the full path /users/user/Developer/plugin/file things work as expected. I have tried different methods in order to get the full path for my plugin but everything returns as /.

If there is a plugin out there that is already using external sources properly please just point me to the plugin and I can study how that is achieved.

All 4 comments

Electron is running with weird values for __dirname and __filename, so working with absolute paths is a pain. Instead, you can load your scripts in plain text and execute them as a text script, intead of file. For example, you can check osx-define plugin, that is running python script as a plain text.

Thanks for the pointer! I am not sure if this will become a bigger issue down the road since the work around is feasable for items where we can feed the right path, however there will be instances where a third party module may already have it backed into itself and unless we branch the specific module it won't be usable.

I installed the Define plugin to test it and I am not seeing any definitions, after a quick search it does look like it is a known issue: https://github.com/KELiON/cerebro-osx-define/issues/2

Yep, there is another issue, but it is not related to this question (it is realted to some framework used in python, but in your case you're using built-in osascript). But if you're interested you can see how it works here:)

screen shot 2017-08-17 at 17 37 10

Thanks @KELiON, I tried to build from source to see I could find a work around to this issue and noticed that you are already doing some of that work through WebPack:

  node: {
    __dirname: false,
    __filename: false
  },

https://github.com/webpack/webpack/issues/1599

But I gave up and just decided to use raw-loader https://github.com/webpack-contrib/raw-loader. It works for me and we'll see if no one else needs this feature where they can't use the source from a third party module 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wonzbak picture wonzbak  路  6Comments

vandamm picture vandamm  路  5Comments

nazar-pc picture nazar-pc  路  5Comments

maximbaz picture maximbaz  路  3Comments

prcastro picture prcastro  路  6Comments