Kaydet (Commit) 438efb38 authored tarafından Andras Timar's avatar Andras Timar

fdo#39445 writing out tools/fsys.hxx (basic)

Change-Id: I2ec7546572fa72359615f371715b4aa82b1182ca
üst b82f6851
...@@ -458,12 +458,6 @@ OUString getFullPath( const OUString& aRelPath ); ...@@ -458,12 +458,6 @@ OUString getFullPath( const OUString& aRelPath );
// has not to be infected with UNO) // has not to be infected with UNO)
void implStepRenameUCB( const OUString& aSource, const OUString& aDest ); void implStepRenameUCB( const OUString& aSource, const OUString& aDest );
//*** OSL file access ***
// #87427 OSL need File URLs, so map to getFullPath
inline OUString getFullPathUNC( const OUString& aRelPath )
{
return getFullPath( aRelPath );
}
void implStepRenameOSL( const OUString& aSource, const OUString& aDest ); void implStepRenameOSL( const OUString& aSource, const OUString& aDest );
bool IsBaseIndexOne(); bool IsBaseIndexOne();
......
...@@ -38,11 +38,7 @@ ...@@ -38,11 +38,7 @@
#include "runtime.hxx" #include "runtime.hxx"
#include "sbunoobj.hxx" #include "sbunoobj.hxx"
#ifdef WNT
#include <tools/fsys.hxx>
#else
#include <osl/file.hxx> #include <osl/file.hxx>
#endif
#include "errobject.hxx" #include "errobject.hxx"
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
...@@ -548,7 +544,7 @@ void implStepRenameUCB( const OUString& aSource, const OUString& aDest ) ...@@ -548,7 +544,7 @@ void implStepRenameUCB( const OUString& aSource, const OUString& aDest )
// Implementation of StepRENAME with OSL // Implementation of StepRENAME with OSL
void implStepRenameOSL( const OUString& aSource, const OUString& aDest ) void implStepRenameOSL( const OUString& aSource, const OUString& aDest )
{ {
FileBase::RC nRet = File::move( getFullPathUNC( aSource ), getFullPathUNC( aDest ) ); FileBase::RC nRet = File::move( getFullPath( aSource ), getFullPath( aDest ) );
if( nRet != FileBase::E_None ) if( nRet != FileBase::E_None )
{ {
StarBASIC::Error( SbERR_PATH_NOT_FOUND ); StarBASIC::Error( SbERR_PATH_NOT_FOUND );
...@@ -582,7 +578,7 @@ RTLFUNC(FileCopy) ...@@ -582,7 +578,7 @@ RTLFUNC(FileCopy)
} }
else else
{ {
FileBase::RC nRet = File::copy( getFullPathUNC( aSource ), getFullPathUNC( aDest ) ); FileBase::RC nRet = File::copy( getFullPath( aSource ), getFullPath( aDest ) );
if( nRet != FileBase::E_None ) if( nRet != FileBase::E_None )
{ {
StarBASIC::Error( SbERR_PATH_NOT_FOUND ); StarBASIC::Error( SbERR_PATH_NOT_FOUND );
...@@ -626,7 +622,7 @@ RTLFUNC(Kill) ...@@ -626,7 +622,7 @@ RTLFUNC(Kill)
} }
else else
{ {
File::remove( getFullPathUNC( aFileSpec ) ); File::remove( getFullPath( aFileSpec ) );
} }
} }
else else
...@@ -662,7 +658,7 @@ RTLFUNC(MkDir) ...@@ -662,7 +658,7 @@ RTLFUNC(MkDir)
} }
else else
{ {
Directory::create( getFullPathUNC( aPath ) ); Directory::create( getFullPath( aPath ) );
} }
} }
else else
...@@ -774,7 +770,7 @@ RTLFUNC(RmDir) ...@@ -774,7 +770,7 @@ RTLFUNC(RmDir)
} }
else else
{ {
implRemoveDirRecursive( getFullPathUNC( aPath ) ); implRemoveDirRecursive( getFullPath( aPath ) );
} }
} }
else else
...@@ -840,7 +836,7 @@ RTLFUNC(FileLen) ...@@ -840,7 +836,7 @@ RTLFUNC(FileLen)
else else
{ {
DirectoryItem aItem; DirectoryItem aItem;
DirectoryItem::get( getFullPathUNC( aStr ), aItem ); DirectoryItem::get( getFullPath( aStr ), aItem );
FileStatus aFileStatus( osl_FileStatus_Mask_FileSize ); FileStatus aFileStatus( osl_FileStatus_Mask_FileSize );
aItem.getFileStatus( aFileStatus ); aItem.getFileStatus( aFileStatus );
nLen = (sal_Int32)aFileStatus.getFileSize(); nLen = (sal_Int32)aFileStatus.getFileSize();
...@@ -2927,18 +2923,16 @@ RTLFUNC(GetAttr) ...@@ -2927,18 +2923,16 @@ RTLFUNC(GetAttr)
{ {
sal_Int16 nFlags = 0; sal_Int16 nFlags = 0;
// In Windows, We want to use Windows API to get the file attributes // In Windows, we want to use Windows API to get the file attributes
// for VBA interoperability. // for VBA interoperability.
#if defined( WNT ) #if defined( WNT )
if( SbiRuntime::isVBAEnabled() ) if( SbiRuntime::isVBAEnabled() )
{ {
DirEntry aEntry( rPar.Get(1)->GetOUString() ); OUString aPathURL = getFullPath( rPar.Get(1)->GetOUString() );
aEntry.ToAbs(); OUString aPath;
getSystemPathFromFileURL( aPathURL, aPath );
// #57064 extract the real-path for virtual URLs OString aSystemPath(OUStringToOString(aPath, osl_getThreadTextEncoding()));
OString aByteStrFullPath(OUStringToOString(aEntry.GetFull(), DWORD nRealFlags = GetFileAttributes (aSystemPath.getStr());
osl_getThreadTextEncoding()));
DWORD nRealFlags = GetFileAttributes (aByteStrFullPath.getStr());
if (nRealFlags != 0xffffffff) if (nRealFlags != 0xffffffff)
{ {
if (nRealFlags == FILE_ATTRIBUTE_NORMAL) if (nRealFlags == FILE_ATTRIBUTE_NORMAL)
...@@ -2999,7 +2993,7 @@ RTLFUNC(GetAttr) ...@@ -2999,7 +2993,7 @@ RTLFUNC(GetAttr)
else else
{ {
DirectoryItem aItem; DirectoryItem aItem;
DirectoryItem::get( getFullPathUNC( rPar.Get(1)->GetOUString() ), aItem ); DirectoryItem::get( getFullPath( rPar.Get(1)->GetOUString() ), aItem );
FileStatus aFileStatus( osl_FileStatus_Mask_Attributes | osl_FileStatus_Mask_Type ); FileStatus aFileStatus( osl_FileStatus_Mask_Attributes | osl_FileStatus_Mask_Type );
aItem.getFileStatus( aFileStatus ); aItem.getFileStatus( aFileStatus );
sal_uInt64 nAttributes = aFileStatus.getAttributes(); sal_uInt64 nAttributes = aFileStatus.getAttributes();
...@@ -3059,7 +3053,7 @@ RTLFUNC(FileDateTime) ...@@ -3059,7 +3053,7 @@ RTLFUNC(FileDateTime)
else else
{ {
DirectoryItem aItem; DirectoryItem aItem;
DirectoryItem::get( getFullPathUNC( aPath ), aItem ); DirectoryItem::get( getFullPath( aPath ), aItem );
FileStatus aFileStatus( osl_FileStatus_Mask_ModifyTime ); FileStatus aFileStatus( osl_FileStatus_Mask_ModifyTime );
aItem.getFileStatus( aFileStatus ); aItem.getFileStatus( aFileStatus );
TimeValue aTimeVal = aFileStatus.getModifyTime(); TimeValue aTimeVal = aFileStatus.getModifyTime();
...@@ -3506,7 +3500,7 @@ RTLFUNC(Shell) ...@@ -3506,7 +3500,7 @@ RTLFUNC(Shell)
std::list<String>::const_iterator iter = aTokenList.begin(); std::list<String>::const_iterator iter = aTokenList.begin();
const OUString& rStr = *iter; const OUString& rStr = *iter;
OUString aOUStrProg( rStr.getStr(), rStr.getLength() ); OUString aOUStrProg( rStr.getStr(), rStr.getLength() );
OUString aOUStrProgUNC = getFullPathUNC( aOUStrProg ); OUString aOUStrProgURL = getFullPath( aOUStrProg );
++iter; ++iter;
...@@ -3526,7 +3520,7 @@ RTLFUNC(Shell) ...@@ -3526,7 +3520,7 @@ RTLFUNC(Shell)
oslProcess pApp; oslProcess pApp;
sal_Bool bSucc = osl_executeProcess( sal_Bool bSucc = osl_executeProcess(
aOUStrProgUNC.pData, aOUStrProgURL.pData,
pParamList, pParamList,
nParamCount, nParamCount,
nOptions, nOptions,
...@@ -4583,7 +4577,7 @@ RTLFUNC(FileExists) ...@@ -4583,7 +4577,7 @@ RTLFUNC(FileExists)
else else
{ {
DirectoryItem aItem; DirectoryItem aItem;
FileBase::RC nRet = DirectoryItem::get( getFullPathUNC( aStr ), aItem ); FileBase::RC nRet = DirectoryItem::get( getFullPath( aStr ), aItem );
bExists = (nRet == FileBase::E_None); bExists = (nRet == FileBase::E_None);
} }
rPar.Get(0)->PutBool( bExists ); rPar.Get(0)->PutBool( bExists );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment