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
commit2907f0852633983033dc6582ad7a187d47fa5973 (patch)
tree400f2e003c9fdcd775120ba3f0d4b158f95c8b54 /sal
parentbb96b3ee0d39a58c86d83dfdac18ff6d4088835d (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.cxx70
-rw-r--r--sal/rtl/source/alloc_arena.c2
2 files changed, 25 insertions, 47 deletions
diff --git a/sal/osl/os2/file.cxx b/sal/osl/os2/file.cxx
index 6e1b5b7e546e..e89ce6450bee 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 );
@@ -1991,7 +1993,25 @@ oslFileError osl_setFileAttributes( rtl_uString* ustrFileURL, sal_uInt64 uAttrib
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 3866406ed9dd..091f56aa3853 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
/* ================================================================= *