1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_FileSystemUtils_h
8 #define mozilla_dom_FileSystemUtils_h
10 #include "nsIGlobalObject.h"
11 #include "nsStringFwd.h"
17 namespace mozilla::dom
{
19 #define FILESYSTEM_DOM_PATH_SEPARATOR_LITERAL "/"
20 #define FILESYSTEM_DOM_PATH_SEPARATOR_CHAR '/'
23 * This class is for error handling.
24 * All methods in this class are static.
26 class FileSystemUtils
{
29 * Return true if aDescendantPath is a descendant of aPath.
31 static bool IsDescendantPath(const nsAString
& aPath
,
32 const nsAString
& aDescendantPath
);
35 * Return true if this is valid DOMPath. It also splits the path in
36 * subdirectories and stores them in aParts.
38 static bool IsValidRelativeDOMPath(const nsAString
& aPath
,
39 nsTArray
<nsString
>& aParts
);
42 * Helper method. If aGlobal is null, the SystemGroup EventTarget will be
45 static nsresult
DispatchRunnable(nsIGlobalObject
* aGlobal
,
46 already_AddRefed
<nsIRunnable
>&& aRunnable
);
49 } // namespace mozilla::dom
51 #endif // mozilla_dom_FileSystemUtils_h