Removed never defined _OLD_FILE_IMPL
This commit is contained in:
@@ -53,11 +53,6 @@ using namespace com::sun::star::lang;
|
|||||||
using namespace com::sun::star::container;
|
using namespace com::sun::star::container;
|
||||||
|
|
||||||
|
|
||||||
// Define activates old file implementation
|
|
||||||
// (only in non UCB case)
|
|
||||||
// #define _OLD_FILE_IMPL
|
|
||||||
|
|
||||||
|
|
||||||
namespace basicEncoder
|
namespace basicEncoder
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -141,11 +136,7 @@ class SbiRTLData
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
#ifdef _OLD_FILE_IMPL
|
|
||||||
Dir* pDir;
|
|
||||||
#else
|
|
||||||
::osl::Directory* pDir;
|
::osl::Directory* pDir;
|
||||||
#endif
|
|
||||||
sal_Int16 nDirFlags;
|
sal_Int16 nDirFlags;
|
||||||
short nCurDirPos;
|
short nCurDirPos;
|
||||||
|
|
||||||
|
@@ -338,8 +338,6 @@ sal_Bool hasUno( void )
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef _OLD_FILE_IMPL
|
|
||||||
|
|
||||||
class OslStream : public SvStream
|
class OslStream : public SvStream
|
||||||
{
|
{
|
||||||
osl::File maFile;
|
osl::File maFile;
|
||||||
@@ -427,7 +425,7 @@ void OslStream::SetSize( sal_uIntPtr nSize )
|
|||||||
maFile.setSize( (sal_uInt64)nSize );
|
maFile.setSize( (sal_uInt64)nSize );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef _USE_UNO
|
#ifdef _USE_UNO
|
||||||
@@ -658,11 +656,7 @@ SbError SbiStream::Open
|
|||||||
#endif
|
#endif
|
||||||
if( !pStrm )
|
if( !pStrm )
|
||||||
{
|
{
|
||||||
#ifdef _OLD_FILE_IMPL
|
|
||||||
pStrm = new SvFileStream( aNameStr, nStrmMode );
|
|
||||||
#else
|
|
||||||
pStrm = new OslStream( aNameStr, nStrmMode );
|
pStrm = new OslStream( aNameStr, nStrmMode );
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if( IsAppend() )
|
if( IsAppend() )
|
||||||
pStrm->Seek( STREAM_SEEK_TO_END );
|
pStrm->Seek( STREAM_SEEK_TO_END );
|
||||||
@@ -676,12 +670,6 @@ SbError SbiStream::Close()
|
|||||||
{
|
{
|
||||||
if( pStrm )
|
if( pStrm )
|
||||||
{
|
{
|
||||||
if( !hasUno() )
|
|
||||||
{
|
|
||||||
#ifdef _OLD_FILE_IMPL
|
|
||||||
((SvFileStream *)pStrm)->Close();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
MapError();
|
MapError();
|
||||||
delete pStrm;
|
delete pStrm;
|
||||||
pStrm = NULL;
|
pStrm = NULL;
|
||||||
|
@@ -616,22 +616,11 @@ RTLFUNC(FileCopy) // JSM
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef _OLD_FILE_IMPL
|
|
||||||
DirEntry aSourceDirEntry(aSource);
|
|
||||||
if (aSourceDirEntry.Exists())
|
|
||||||
{
|
|
||||||
if (aSourceDirEntry.CopyTo(DirEntry(aDest),FSYS_ACTION_COPYFILE) != FSYS_ERR_OK)
|
|
||||||
StarBASIC::Error( SbERR_PATH_NOT_FOUND );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
StarBASIC::Error( SbERR_PATH_NOT_FOUND );
|
|
||||||
#else
|
|
||||||
FileBase::RC nRet = File::copy( getFullPathUNC( aSource ), getFullPathUNC( aDest ) );
|
FileBase::RC nRet = File::copy( getFullPathUNC( aSource ), getFullPathUNC( aDest ) );
|
||||||
if( nRet != FileBase::E_None )
|
if( nRet != FileBase::E_None )
|
||||||
{
|
{
|
||||||
StarBASIC::Error( SbERR_PATH_NOT_FOUND );
|
StarBASIC::Error( SbERR_PATH_NOT_FOUND );
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -671,12 +660,7 @@ RTLFUNC(Kill) // JSM
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef _OLD_FILE_IMPL
|
|
||||||
if(DirEntry(aFileSpec).Kill() != FSYS_ERR_OK)
|
|
||||||
StarBASIC::Error( SbERR_PATH_NOT_FOUND );
|
|
||||||
#else
|
|
||||||
File::remove( getFullPathUNC( aFileSpec ) );
|
File::remove( getFullPathUNC( aFileSpec ) );
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -740,12 +724,7 @@ RTLFUNC(MkDir) // JSM
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef _OLD_FILE_IMPL
|
|
||||||
if (!DirEntry(aPath).MakeDir())
|
|
||||||
StarBASIC::Error( SbERR_PATH_NOT_FOUND );
|
|
||||||
#else
|
|
||||||
Directory::create( getFullPathUNC( aPath ) );
|
Directory::create( getFullPathUNC( aPath ) );
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -753,8 +732,6 @@ RTLFUNC(MkDir) // JSM
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef _OLD_FILE_IMPL
|
|
||||||
|
|
||||||
// In OSL only empty directories can be deleted
|
// In OSL only empty directories can be deleted
|
||||||
// so we have to delete all files recursively
|
// so we have to delete all files recursively
|
||||||
void implRemoveDirRecursive( const String& aDirPath )
|
void implRemoveDirRecursive( const String& aDirPath )
|
||||||
@@ -810,7 +787,6 @@ void implRemoveDirRecursive( const String& aDirPath )
|
|||||||
|
|
||||||
nRet = Directory::remove( aDirPath );
|
nRet = Directory::remove( aDirPath );
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
RTLFUNC(RmDir) // JSM
|
RTLFUNC(RmDir) // JSM
|
||||||
@@ -857,13 +833,7 @@ RTLFUNC(RmDir) // JSM
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef _OLD_FILE_IMPL
|
|
||||||
DirEntry aDirEntry(aPath);
|
|
||||||
if (aDirEntry.Kill() != FSYS_ERR_OK)
|
|
||||||
StarBASIC::Error( SbERR_PATH_NOT_FOUND );
|
|
||||||
#else
|
|
||||||
implRemoveDirRecursive( getFullPathUNC( aPath ) );
|
implRemoveDirRecursive( getFullPathUNC( aPath ) );
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -924,16 +894,11 @@ RTLFUNC(FileLen)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef _OLD_FILE_IMPL
|
|
||||||
FileStat aStat = DirEntry( aStr );
|
|
||||||
nLen = aStat.GetSize();
|
|
||||||
#else
|
|
||||||
DirectoryItem aItem;
|
DirectoryItem aItem;
|
||||||
DirectoryItem::get( getFullPathUNC( aStr ), aItem );
|
DirectoryItem::get( getFullPathUNC( aStr ), aItem );
|
||||||
FileStatus aFileStatus( FileStatusMask_FileSize );
|
FileStatus aFileStatus( FileStatusMask_FileSize );
|
||||||
aItem.getFileStatus( aFileStatus );
|
aItem.getFileStatus( aFileStatus );
|
||||||
nLen = (sal_Int32)aFileStatus.getFileSize();
|
nLen = (sal_Int32)aFileStatus.getFileSize();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
rPar.Get(0)->PutLong( (long)nLen );
|
rPar.Get(0)->PutLong( (long)nLen );
|
||||||
}
|
}
|
||||||
@@ -2831,60 +2796,6 @@ RTLFUNC(Dir)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef _OLD_FILE_IMPL
|
|
||||||
if ( nParCount >= 2 )
|
|
||||||
{
|
|
||||||
delete pRTLData->pDir;
|
|
||||||
pRTLData->pDir = 0; // wg. Sonderbehandlung Sb_ATTR_VOLUME
|
|
||||||
DirEntry aEntry( rPar.Get(1)->GetString() );
|
|
||||||
FileStat aStat( aEntry );
|
|
||||||
if(!aStat.GetError() && (aStat.GetKind() & FSYS_KIND_FILE))
|
|
||||||
{
|
|
||||||
// ah ja, ist nur ein dateiname
|
|
||||||
// Pfad abschneiden (wg. VB4)
|
|
||||||
rPar.Get(0)->PutString( aEntry.GetName() );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
sal_uInt16 nFlags = 0;
|
|
||||||
if ( nParCount > 2 )
|
|
||||||
pRTLData->nDirFlags = nFlags = rPar.Get(2)->GetInteger();
|
|
||||||
else
|
|
||||||
pRTLData->nDirFlags = 0;
|
|
||||||
|
|
||||||
// Sb_ATTR_VOLUME wird getrennt gehandelt
|
|
||||||
if( pRTLData->nDirFlags & Sb_ATTR_VOLUME )
|
|
||||||
aPath = aEntry.GetVolume();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Die richtige Auswahl treffen
|
|
||||||
sal_uInt16 nMode = FSYS_KIND_FILE;
|
|
||||||
if( nFlags & Sb_ATTR_DIRECTORY )
|
|
||||||
nMode |= FSYS_KIND_DIR;
|
|
||||||
if( nFlags == Sb_ATTR_DIRECTORY )
|
|
||||||
nMode = FSYS_KIND_DIR;
|
|
||||||
pRTLData->pDir = new Dir( aEntry, (DirEntryKind) nMode );
|
|
||||||
pRTLData->nCurDirPos = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( pRTLData->pDir )
|
|
||||||
{
|
|
||||||
for( ;; )
|
|
||||||
{
|
|
||||||
if( pRTLData->nCurDirPos >= pRTLData->pDir->Count() )
|
|
||||||
{
|
|
||||||
delete pRTLData->pDir;
|
|
||||||
pRTLData->pDir = 0;
|
|
||||||
aPath.Erase();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
DirEntry aNextEntry=(*(pRTLData->pDir))[pRTLData->nCurDirPos++];
|
|
||||||
aPath = aNextEntry.GetName(); //Full();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
rPar.Get(0)->PutString( aPath );
|
|
||||||
#else
|
|
||||||
// TODO: OSL
|
// TODO: OSL
|
||||||
if ( nParCount >= 2 )
|
if ( nParCount >= 2 )
|
||||||
{
|
{
|
||||||
@@ -2981,7 +2892,6 @@ RTLFUNC(Dir)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
rPar.Get(0)->PutString( aPath );
|
rPar.Get(0)->PutString( aPath );
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3109,12 +3019,6 @@ RTLFUNC(FileDateTime)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef _OLD_FILE_IMPL
|
|
||||||
DirEntry aEntry( aPath );
|
|
||||||
FileStat aStat( aEntry );
|
|
||||||
aTime = Time( aStat.TimeModified() );
|
|
||||||
aDate = Date( aStat.DateModified() );
|
|
||||||
#else
|
|
||||||
DirectoryItem aItem;
|
DirectoryItem aItem;
|
||||||
DirectoryItem::get( getFullPathUNC( aPath ), aItem );
|
DirectoryItem::get( getFullPathUNC( aPath ), aItem );
|
||||||
FileStatus aFileStatus( FileStatusMask_ModifyTime );
|
FileStatus aFileStatus( FileStatusMask_ModifyTime );
|
||||||
@@ -3125,7 +3029,6 @@ RTLFUNC(FileDateTime)
|
|||||||
|
|
||||||
aTime = Time( aDT.Hours, aDT.Minutes, aDT.Seconds, 10000000*aDT.NanoSeconds );
|
aTime = Time( aDT.Hours, aDT.Minutes, aDT.Seconds, 10000000*aDT.NanoSeconds );
|
||||||
aDate = Date( aDT.Day, aDT.Month, aDT.Year );
|
aDate = Date( aDT.Day, aDT.Month, aDT.Year );
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double fSerial = (double)GetDayDiff( aDate );
|
double fSerial = (double)GetDayDiff( aDate );
|
||||||
@@ -4449,39 +4352,6 @@ RTLFUNC(SetAttr) // JSM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
#ifdef _OLD_FILE_IMPL
|
|
||||||
// #57064 Bei virtuellen URLs den Real-Path extrahieren
|
|
||||||
DirEntry aEntry( aStr );
|
|
||||||
String aFile = aEntry.GetFull();
|
|
||||||
ByteString aByteFile( aFile, gsl_getSystemTextEncoding() );
|
|
||||||
#ifdef WNT
|
|
||||||
if (!SetFileAttributes (aByteFile.GetBuffer(),(DWORD)nFlags))
|
|
||||||
StarBASIC::Error(SbERR_FILE_NOT_FOUND);
|
|
||||||
#endif
|
|
||||||
#ifdef OS2
|
|
||||||
FILESTATUS3 aFileStatus;
|
|
||||||
APIRET rc = DosQueryPathInfo(aByteFile.GetBuffer(),1,
|
|
||||||
&aFileStatus,sizeof(FILESTATUS3));
|
|
||||||
if (!rc)
|
|
||||||
{
|
|
||||||
if (aFileStatus.attrFile != nFlags)
|
|
||||||
{
|
|
||||||
aFileStatus.attrFile = nFlags;
|
|
||||||
rc = DosSetPathInfo(aFile.GetStr(),1,
|
|
||||||
&aFileStatus,sizeof(FILESTATUS3),0);
|
|
||||||
if (rc)
|
|
||||||
StarBASIC::Error( SbERR_FILE_NOT_FOUND );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
StarBASIC::Error( SbERR_FILE_NOT_FOUND );
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
// Not implemented
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
StarBASIC::Error( SbERR_BAD_ARGUMENT );
|
StarBASIC::Error( SbERR_BAD_ARGUMENT );
|
||||||
@@ -4550,14 +4420,9 @@ RTLFUNC(FileExists)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef _OLD_FILE_IMPL
|
|
||||||
DirEntry aEntry( aStr );
|
|
||||||
bExists = aEntry.Exists();
|
|
||||||
#else
|
|
||||||
DirectoryItem aItem;
|
DirectoryItem aItem;
|
||||||
FileBase::RC nRet = DirectoryItem::get( getFullPathUNC( aStr ), aItem );
|
FileBase::RC nRet = DirectoryItem::get( getFullPathUNC( aStr ), aItem );
|
||||||
bExists = (nRet == FileBase::E_None);
|
bExists = (nRet == FileBase::E_None);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
rPar.Get(0)->PutBool( bExists );
|
rPar.Get(0)->PutBool( bExists );
|
||||||
}
|
}
|
||||||
|
@@ -1349,18 +1349,7 @@ void SbiRuntime::StepRENAME() // Rename Tos+1 to Tos
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef _OLD_FILE_IMPL
|
|
||||||
DirEntry aSourceDirEntry( aSource );
|
|
||||||
if( aSourceDirEntry.Exists() )
|
|
||||||
{
|
|
||||||
if( aSourceDirEntry.MoveTo( DirEntry(aDest) ) != FSYS_ERR_OK )
|
|
||||||
StarBASIC::Error( SbERR_PATH_NOT_FOUND );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
StarBASIC::Error( SbERR_PATH_NOT_FOUND );
|
|
||||||
#else
|
|
||||||
implStepRenameOSL( aSource, aDest );
|
implStepRenameOSL( aSource, aDest );
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user