Search code examples
javascriptfirefoxfirefox-addonfirefox-addon-sdk

Get the Filepath Separator of the current Environment with Firefox SDK API


I need to get the Filepath Delimiter of the current Environment with Firefox SDK API as String, i can't use io/file#join cause it throws an Exception for invalid paths, but i need to generate such an invalid path with the correct path delimiter.

Is there a way to get the current path separator using the firefox sdk api?


Solution

  • You can use var path = require('sdk/fs/path'); like so:

    • path.sep is / or \ depending on your OS.

    Take a look at the tests for a few examples.