diff options
author | Oliver Bolte <obo@openoffice.org> | 2008-07-22 16:39:08 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2008-07-22 16:39:08 +0000 |
commit | e9db48887e0227a7456e9663c8ad4c7141d7e9fd (patch) | |
tree | 3028253ccb0bde6e140634814fa86d9a36e805f6 /tools/source/fsys | |
parent | f0ac8d2a9ac0da8a8b1e9e90470670e03040f0db (diff) |
INTEGRATION: CWS os2port03 (1.8.54); FILE MERGED
2008/07/16 13:45:37 obr 1.8.54.2: RESYNC: (1.8-1.9); FILE MERGED
2008/04/15 14:41:15 ydario 1.8.54.1: Issue number: i85203
Submitted by: ydario
Reviewed by: ydario
Diffstat (limited to 'tools/source/fsys')
-rw-r--r-- | tools/source/fsys/filecopy.cxx | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/tools/source/fsys/filecopy.cxx b/tools/source/fsys/filecopy.cxx index 0a7bcf6d6ed4..5b98002fd999 100644 --- a/tools/source/fsys/filecopy.cxx +++ b/tools/source/fsys/filecopy.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: filecopy.cxx,v $ - * $Revision: 1.9 $ + * $Revision: 1.10 $ * * This file is part of OpenOffice.org. * @@ -37,6 +37,13 @@ #include <tools/svwin.h> #endif +#elif defined(OS2) +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <share.h> +#include <io.h> + #elif defined UNX #include <fcntl.h> #include <unistd.h> @@ -259,6 +266,55 @@ FSysError FileCopier::DoCopy_Impl( FileStat aSourceFileStat( rSource ); if ( aSourceFileStat.IsKind( FSYS_KIND_DIR ) ) { +#ifdef OS2 + CHAR szSource[CCHMAXPATHCOMP]; + HOBJECT hSourceObject; + + strcpy(szSource, ByteString(rSource.GetFull(), osl_getThreadTextEncoding()).GetBuffer()); + hSourceObject = WinQueryObject(szSource); + + if ( hSourceObject ) + { + PSZ pszSourceName; + PSZ pszTargetName; + CHAR szTarget[CCHMAXPATHCOMP]; + HOBJECT hTargetObject; + HOBJECT hReturn = NULLHANDLE; + + strcpy(szTarget, ByteString(rTarget.GetFull(), osl_getThreadTextEncoding()).GetBuffer()); + pszTargetName = strrchr(szTarget, '\\'); + pszSourceName = strrchr(szSource, '\\'); + + hTargetObject = WinQueryObject(szTarget); + + if ( hTargetObject ) + WinDestroyObject(hTargetObject); + + if ( pszTargetName && pszSourceName ) + { + *pszTargetName = '\0'; + pszSourceName++; + pszTargetName++; + + if(strcmp(pszSourceName, pszTargetName) == 0) + { + hTargetObject = WinQueryObject(szTarget); + + if(pImp->nActions & FSYS_ACTION_MOVE) + { + hReturn = WinMoveObject(hSourceObject, hTargetObject, 0); + } + else + { + hReturn = WinCopyObject(hSourceObject, hTargetObject, 0); + } + if ( bMakeShortNames && aTarget.Exists() ) + aTarget.Kill(); + return hReturn ? FSYS_ERR_OK : FSYS_ERR_UNKNOWN; + } + } + } +#endif // recursive copy eRet = Error( aTgt.MakeDir() ? FSYS_ERR_OK : FSYS_ERR_UNKNOWN, 0, &aTgt ); Dir aSourceDir( rSource, FSYS_KIND_DIR|FSYS_KIND_FILE ); |