gecko-dev/xpcom/io/nsFileSpecWin.cpp

85 lines
3.2 KiB
C++
Raw Normal View History

1998-12-08 02:15:50 +00:00
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
// This file is included by nsFileSpec.cp, and includes the Windows-specific
1998-12-08 02:15:50 +00:00
// implementations.
//----------------------------------------------------------------------------------------
nsNativeFileSpec::nsNativeFileSpec(const nsFilePath& inPath)
1998-12-08 02:15:50 +00:00
//----------------------------------------------------------------------------------------
: mPath(NULL)
1998-12-08 02:15:50 +00:00
{
*this = inPath;
}
//----------------------------------------------------------------------------------------
void nsNativeFileSpec::operator = (const nsFilePath& inPath)
1998-12-08 02:15:50 +00:00
//----------------------------------------------------------------------------------------
{
// Convert '/' to '\'
nsFileSpecHelpers::StringAssign(mPath, inSpec.mPath);
for (const char* cp = mPath; *cp; cp++)
1998-12-08 02:15:50 +00:00
{
if (*cp == '/')
*cp = '\\';
1998-12-08 02:15:50 +00:00
}
} // nsNativeFileSpec::operator =
1998-12-09 01:04:53 +00:00
//----------------------------------------------------------------------------------------
nsFilePath::nsFilePath(const nsNativeFileSpec& inSpec)
//----------------------------------------------------------------------------------------
: mPath(NULL)
1998-12-09 01:04:53 +00:00
{
*this = inSpec;
} // nsFilePath::nsFilePath
//----------------------------------------------------------------------------------------
void nsFilePath::operator = (const nsNativeFileSpec& inSpec)
//----------------------------------------------------------------------------------------
{
1998-12-09 01:04:53 +00:00
// Convert '\' to '/'
nsFileSpecHelpers::StringAssign(mPath, inSpec.mPath);
for (const char* cp = mPath; *cp; cp++)
1998-12-09 01:04:53 +00:00
{
if (*cp == '\\')
*cp = '/';
1998-12-09 01:04:53 +00:00
}
} // nsFilePath::operator =
1998-12-09 01:04:53 +00:00
1998-12-08 02:15:50 +00:00
//----------------------------------------------------------------------------------------
void nsNativeFileSpec::SetLeafName(const char* inLeafName)
1998-12-08 02:15:50 +00:00
//----------------------------------------------------------------------------------------
{
1998-12-09 01:04:53 +00:00
nsFileSpecHelpers::LeafReplace(mPath, '\\', inLeafName);
1998-12-08 02:15:50 +00:00
} // nsNativeFileSpec::SetLeafName
//----------------------------------------------------------------------------------------
const char* nsNativeFileSpec::GetLeafName() const
1998-12-08 02:15:50 +00:00
//----------------------------------------------------------------------------------------
{
1998-12-09 01:04:53 +00:00
return nsFileSpecHelpers::GetLeaf(mPath, '\\');
1998-12-08 02:15:50 +00:00
} // nsNativeFileSpec::GetLeafName
1998-12-09 01:04:53 +00:00
//----------------------------------------------------------------------------------------
bool nsNativeFileSpec::Exists() const
//----------------------------------------------------------------------------------------
{
return false; // fixme
} // nsNativeFileSpec::Exists