michael@0: /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ michael@0: /* vim: set ts=2 et sw=2 tw=80: */ 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: #ifndef mozilla_dom_FileSystemUtils_h michael@0: #define mozilla_dom_FileSystemUtils_h michael@0: michael@0: #include "nsString.h" michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: michael@0: #define FILESYSTEM_DOM_PATH_SEPARATOR "/" michael@0: michael@0: /* michael@0: * This class is for error handling. michael@0: * All methods in this class are static. michael@0: */ michael@0: class FileSystemUtils michael@0: { michael@0: public: michael@0: /* michael@0: * Convert the path separator to "/". michael@0: */ michael@0: static void michael@0: LocalPathToNormalizedPath(const nsAString& aLocal, nsAString& aNorm); michael@0: michael@0: /* michael@0: * Convert the normalized path separator "/" to the system dependent path michael@0: * separator, which is "/" on Mac and Linux, and "\" on Windows. michael@0: */ michael@0: static void michael@0: NormalizedPathToLocalPath(const nsAString& aNorm, nsAString& aLocal); michael@0: michael@0: /* michael@0: * Return true if aDescendantPath is a descendant of aPath. Both aPath and michael@0: * aDescendantPath are absolute DOM path. michael@0: */ michael@0: static bool michael@0: IsDescendantPath(const nsAString& aPath, const nsAString& aDescendantPath); michael@0: michael@0: static bool michael@0: IsParentProcess(); michael@0: michael@0: static const char16_t kSeparatorChar = char16_t('/'); michael@0: }; michael@0: michael@0: } // namespace dom michael@0: } // namespace mozilla michael@0: michael@0: #endif // mozilla_dom_FileSystemUtils_h