2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2014-03-05 07:25:40 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_FileSystemUtils_h
|
|
|
|
#define mozilla_dom_FileSystemUtils_h
|
|
|
|
|
2016-03-20 13:56:10 +03:00
|
|
|
class nsIFile;
|
2017-04-05 10:47:34 +03:00
|
|
|
class nsIRunnable;
|
2014-03-05 07:25:40 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2016-03-20 13:56:10 +03:00
|
|
|
#define FILESYSTEM_DOM_PATH_SEPARATOR_LITERAL "/"
|
|
|
|
#define FILESYSTEM_DOM_PATH_SEPARATOR_CHAR '/'
|
2014-03-05 07:25:40 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This class is for error handling.
|
|
|
|
* All methods in this class are static.
|
|
|
|
*/
|
|
|
|
class FileSystemUtils {
|
|
|
|
public:
|
2016-03-20 13:56:10 +03:00
|
|
|
/*
|
|
|
|
* Return true if aDescendantPath is a descendant of aPath.
|
|
|
|
*/
|
2017-03-16 10:53:49 +03:00
|
|
|
static bool IsDescendantPath(const nsAString& aPath,
|
|
|
|
const nsAString& aDescendantPath);
|
2016-06-07 01:55:17 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if this is valid DOMPath. It also splits the path in
|
|
|
|
* subdirectories and stores them in aParts.
|
|
|
|
*/
|
|
|
|
static bool IsValidRelativeDOMPath(const nsAString& aPath,
|
|
|
|
nsTArray<nsString>& aParts);
|
2017-04-05 10:47:34 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper method. If aGlobal is null, the SystemGroup EventTarget will be
|
|
|
|
* used.
|
|
|
|
*/
|
|
|
|
static nsresult DispatchRunnable(nsIGlobalObject* aGlobal,
|
|
|
|
already_AddRefed<nsIRunnable>&& aRunnable);
|
2014-03-05 07:25:40 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_FileSystemUtils_h
|