mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
59 lines
1.4 KiB
C++
59 lines
1.4 KiB
C++
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
/* 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/. */
|
|
|
|
#include "mozilla/dom/FileSystemUtils.h"
|
|
|
|
#include "nsXULAppAPI.h"
|
|
|
|
namespace mozilla {
|
|
namespace dom {
|
|
|
|
// static
|
|
void
|
|
FileSystemUtils::LocalPathToNormalizedPath(const nsAString& aLocal,
|
|
nsAString& aNorm)
|
|
{
|
|
nsString result;
|
|
result = aLocal;
|
|
#if defined(XP_WIN)
|
|
char16_t* cur = result.BeginWriting();
|
|
char16_t* end = result.EndWriting();
|
|
for (; cur < end; ++cur) {
|
|
if (char16_t('\\') == *cur)
|
|
*cur = char16_t('/');
|
|
}
|
|
#endif
|
|
aNorm = result;
|
|
}
|
|
|
|
// static
|
|
void
|
|
FileSystemUtils::NormalizedPathToLocalPath(const nsAString& aNorm,
|
|
nsAString& aLocal)
|
|
{
|
|
nsString result;
|
|
result = aNorm;
|
|
#if defined(XP_WIN)
|
|
char16_t* cur = result.BeginWriting();
|
|
char16_t* end = result.EndWriting();
|
|
for (; cur < end; ++cur) {
|
|
if (char16_t('/') == *cur)
|
|
*cur = char16_t('\\');
|
|
}
|
|
#endif
|
|
aLocal = result;
|
|
}
|
|
|
|
// static
|
|
bool
|
|
FileSystemUtils::IsParentProcess()
|
|
{
|
|
return XRE_GetProcessType() == GeckoProcessType_Default;
|
|
}
|
|
|
|
} // namespace dom
|
|
} // namespace mozilla
|