Set of utilites for working with files and text content.
Warning: Contrary to the name, this does NOT return a canonical path. The canonical format used by Directory.fullPath actually DOES include the trailing "/"
Compares 2 filenames in lowercases. In Windows it compares the names without the extension first and then the extensions to fix issue #4409
Convert a URI path to a native path. On both platforms, this unescapes the URI On windows, URI paths start with a "/", but have a drive letter ("C:"). In this case, remove the initial "/".
Converts filename to be available in Windows
Convert a Windows-native path to use Unix style slashes. On Windows, this converts "C:\foo\bar\baz.txt" to "C:/foo/bar/baz.txt". On Mac, this does nothing, since Mac paths are already in Unix syntax. (Note that this does not add an initial forward-slash. Internally, our APIs generally use the "C:/foo/bar/baz.txt" style for "native" paths.)
Although this app is generally standardized on folder paths with a trailing "/", some APIs here receive project paths without "/" due to legacy preference storage formats, etc.
Returns the full path to the application directory.
Get the name of a file or a directory, removing any preceding path.
Get the parent directory of a file. If a directory is passed in the directory is returned.
Get the file extension (excluding ".") given a path OR a bare filename. Returns "" for names with no extension. If the name starts with ".", the full remaining text is considered the extension.
Returns a native absolute path to the application source directory. Note that this only works when run in /src/index.html, so it does not work for unit tests (which is run from /test/SpecRunner.html)
WARNING: unlike most paths, this path EXCLUDES the trailing "/".
Given the module object passed to JS module define function, convert the path to a native absolute path. Returns a native absolute path to the module folder.
WARNING: unlike most paths, this path EXCLUDES the trailing "/".
Returns the standard line endings for the current platform
Computes filename as relative to the basePath. For example: basePath: /foo/bar/, filename: /foo/bar/baz.txt returns: baz.txt
The net effect is that the common prefix is stripped away. If basePath is not a prefix of filename, then undefined is returned.
Determine if file extension is a server html file extension.
Determine if file extension is a static html file extension.
Asynchronously reads a file as UTF-8 encoded text.
Scans the first 1000 chars of the text to determine how it encodes line endings. Returns null if usage is mixed or if no line endings found.
Removes the trailing slash from a path, if it has one. Warning: this differs from the format of most paths! Use paths ending in "/" normally, as this is the format used by Directory.fullPath.
Translates any line ending types in the given text to the be the single form specified
Asynchronously writes a file as UTF-8 encoded text.