summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2009-03-02 08:55:03 +0000
committerOliver Bolte <obo@openoffice.org>2009-03-02 08:55:03 +0000
commite5aa7a3e4a119e99513b2fb3da92e2e14488955e (patch)
tree2d47d4083b97ab7b06442c027286b0cd294e5a16 /sal
parent844a1d34fb8888beaeda7a0a21b333d22115b361 (diff)
CWS-TOOLING: integrate CWS os2port05
2009-02-05 19:23:48 +0100 ydario r267438 : i98084: add quotes to paths, required to properly set libpath when installation directory has spaces in it. Fixes ticket:135. 2009-01-22 13:24:00 +0100 ydario r266715 : i98084: use native code to set readonly-hidden flags (see w32), fixes lock files set as readonly and not removable. 2009-01-22 13:22:45 +0100 ydario r266714 : i98084: fix build error with gcc432, requires os2 headers now. 2009-01-21 23:42:58 +0100 ydario r266707 : i98084: properly generates rtti names for unknown symbols, see ticket:138. 2009-01-21 23:41:27 +0100 ydario r266706 : i98084: if xmlsec is not built, certificate is not valid, fixes ticket:138. 2009-01-15 23:39:09 +0100 ydario r266396 : i98084: convert unicode to char for panic dialog messages. 2009-01-15 23:36:13 +0100 ydario r266395 : i98084: use dmake build system instead of configure scripts. 2009-01-15 23:32:05 +0100 ydario r266394 : i98084: add senddoc/open-url integration. changeset 865-866.
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/os2/file.cxx72
-rw-r--r--sal/rtl/source/alloc_arena.c2
2 files changed, 26 insertions, 48 deletions
diff --git a/sal/osl/os2/file.cxx b/sal/osl/os2/file.cxx
index ca9a6ba7d..b967cf197 100644
--- a/sal/osl/os2/file.cxx
+++ b/sal/osl/os2/file.cxx
@@ -174,7 +174,6 @@ static oslFileError osl_psz_createDirectory(const sal_Char* pszPath);
static oslFileError osl_psz_removeDirectory(const sal_Char* pszPath);
static oslFileError osl_psz_copyFile(const sal_Char* pszPath, const sal_Char* pszDestPath);
static oslFileError osl_psz_moveFile(const sal_Char* pszPath, const sal_Char* pszDestPath);
-static oslFileError osl_psz_setFileAttributes(const sal_Char* pszFilePath, sal_uInt64 uAttributes);
static oslFileError osl_psz_setFileTime(const sal_Char* strFilePath, const TimeValue* pCreationTime, const TimeValue* pLastAccessTime, const TimeValue* pLastWriteTime);
@@ -1981,8 +1980,11 @@ oslFileError osl_getCanonicalName( rtl_uString* ustrFileURL, rtl_uString** pustr
oslFileError osl_setFileAttributes( rtl_uString* ustrFileURL, sal_uInt64 uAttributes )
{
- char path[PATH_MAX];
+ char path[PATH_MAX];
oslFileError eRet;
+ FILESTATUS3 fsts3ConfigInfo;
+ ULONG ulBufSize = sizeof(FILESTATUS3);
+ APIRET rc = NO_ERROR;
OSL_ASSERT( ustrFileURL );
@@ -1990,8 +1992,26 @@ oslFileError osl_setFileAttributes( rtl_uString* ustrFileURL, sal_uInt64 uAttrib
eRet = FileURLToPath( path, PATH_MAX, ustrFileURL );
if( eRet != osl_File_E_None )
return eRet;
-
- return osl_psz_setFileAttributes( path, uAttributes );
+
+ /* query current attributes */
+ rc = DosQueryPathInfo( (PCSZ)path, FIL_STANDARD, &fsts3ConfigInfo, ulBufSize);
+ if (rc != NO_ERROR)
+ return MapError( rc);
+
+ /* set/reset readonly/hidden (see w32\file.cxx) */
+ fsts3ConfigInfo.attrFile &= ~(FILE_READONLY | FILE_HIDDEN);
+ if ( uAttributes & osl_File_Attribute_ReadOnly )
+ fsts3ConfigInfo.attrFile |= FILE_READONLY;
+ if ( uAttributes & osl_File_Attribute_Hidden )
+ fsts3ConfigInfo.attrFile |= FILE_HIDDEN;
+
+ /* write new attributes */
+ rc = DosSetPathInfo( (PCSZ)path, FIL_STANDARD, &fsts3ConfigInfo, ulBufSize, 0);
+ if (rc != NO_ERROR)
+ return MapError( rc);
+
+ /* everything ok */
+ return osl_File_E_None;
}
/****************************************************************************/
@@ -2481,50 +2501,6 @@ static oslFileError osl_psz_getVolumeInformation (
return osl_File_E_None;
}
-/*************************************
- * osl_psz_setFileAttributes
- ************************************/
-
-static oslFileError osl_psz_setFileAttributes( const sal_Char* pszFilePath, sal_uInt64 uAttributes )
-{
- oslFileError osl_error = osl_File_E_None;
- mode_t nNewMode = 0;
-
- OSL_ENSURE(!(osl_File_Attribute_Hidden & uAttributes), "osl_File_Attribute_Hidden doesn't work under Unix");
-
- if (uAttributes & osl_File_Attribute_OwnRead)
- nNewMode |= S_IRUSR;
-
- if (uAttributes & osl_File_Attribute_OwnWrite)
- nNewMode|=S_IWUSR;
-
- if (uAttributes & osl_File_Attribute_OwnExe)
- nNewMode|=S_IXUSR;
-
- if (uAttributes & osl_File_Attribute_GrpRead)
- nNewMode|=S_IRGRP;
-
- if (uAttributes & osl_File_Attribute_GrpWrite)
- nNewMode|=S_IWGRP;
-
- if (uAttributes & osl_File_Attribute_GrpExe)
- nNewMode|=S_IXGRP;
-
- if (uAttributes & osl_File_Attribute_OthRead)
- nNewMode|=S_IROTH;
-
- if (uAttributes & osl_File_Attribute_OthWrite)
- nNewMode|=S_IWOTH;
-
- if (uAttributes & osl_File_Attribute_OthExe)
- nNewMode|=S_IXOTH;
-
- if (chmod(pszFilePath, nNewMode) < 0)
- osl_error = oslTranslateFileError(OSL_FET_ERROR, errno);
-
- return osl_error;
-}
-
/******************************************
* osl_psz_setFileTime
*****************************************/
diff --git a/sal/rtl/source/alloc_arena.c b/sal/rtl/source/alloc_arena.c
index 9a7c7715e..926222a0d 100644
--- a/sal/rtl/source/alloc_arena.c
+++ b/sal/rtl/source/alloc_arena.c
@@ -51,6 +51,8 @@
#ifdef OS2
#undef OSL_TRACE
#define OSL_TRACE 1 ? ((void)0) : _OSL_GLOBAL osl_trace
+#define INCL_DOS
+#include <os2.h>
#endif
/* ================================================================= *