michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /** michael@0: * Handling native paths. michael@0: * michael@0: * This module contains a number of functions destined to simplify michael@0: * working with native paths through a cross-platform API. Functions michael@0: * of this module will only work with the following assumptions: michael@0: * michael@0: * - paths are valid; michael@0: * - paths are defined with one of the grammars that this module can michael@0: * parse (see later); michael@0: * - all path concatenations go through function |join|. michael@0: */ michael@0: michael@0: "use strict"; michael@0: michael@0: if (typeof Components == "undefined") { michael@0: let Path; michael@0: if (OS.Constants.Win) { michael@0: Path = require("resource://gre/modules/osfile/ospath_win.jsm"); michael@0: } else { michael@0: Path = require("resource://gre/modules/osfile/ospath_unix.jsm"); michael@0: } michael@0: module.exports = Path; michael@0: } else { michael@0: let Cu = Components.utils; michael@0: let Scope = {}; michael@0: Cu.import("resource://gre/modules/osfile/osfile_shared_allthreads.jsm", Scope); michael@0: michael@0: let Path = {}; michael@0: if (Scope.OS.Constants.Win) { michael@0: Cu.import("resource://gre/modules/osfile/ospath_win.jsm", Path); michael@0: } else { michael@0: Cu.import("resource://gre/modules/osfile/ospath_unix.jsm", Path); michael@0: } michael@0: michael@0: this.EXPORTED_SYMBOLS = []; michael@0: for (let k in Path) { michael@0: this.EXPORTED_SYMBOLS.push(k); michael@0: this[k] = Path[k]; michael@0: } michael@0: }