fdo#60338: Introduce osl_createDirectoryWithFlags

...so that utl::TempFile can pass osl_File_OpenFlag_Private and doesn't have to
resort to umask (the calls to umask around Directory::create had somewhat
erroneously been removed recently with 1d72a0262c
"Related fdo#60338: Create missing temp file dir with user's original umask,"
mistaking this for creation of intermediate directories in the hierarchy).

On Windows, the flags argument to osl_createDirectoryWithFlags is ignored
completely for now.

Change-Id: Iac56a5049d579be729a3f338aa62105123edb6cb
This commit is contained in:
Stephan Bergmann
2014-05-20 18:07:54 +02:00
parent 1122d513ef
commit f65de4feee
6 changed files with 58 additions and 7 deletions

View File

@@ -1130,6 +1130,22 @@ SAL_DLLPUBLIC oslFileError SAL_CALL osl_closeFile( oslFileHandle Handle );
SAL_DLLPUBLIC oslFileError SAL_CALL osl_createDirectory( rtl_uString* pustrDirectoryURL );
/** Create a directory, passing flags.
@param url
File URL of the directory to create.
@param flags
A combination of the same osl_File_OpenFlag_*s used by osl_openFile,
except that osl_File_OpenFlag_Create is implied and ignored. Support for
the various flags can differ across operating systems.
@see osl_createDirectory()
@since LibreOffice 4.3
*/
SAL_DLLPUBLIC oslFileError SAL_CALL osl_createDirectoryWithFlags(
rtl_uString * url, sal_uInt32 flags);
/** Remove an empty directory.

View File

@@ -1849,6 +1849,10 @@ public:
@param ustrDirectoryURL [in]
Full qualified URL of the directory to create.
@param flags [in]
Optional flags, see osl_createDirectoryWithFlags for details. This
defaulted parameter is new since LibreOffice 4.3.
@return
E_None on success
E_INVAL the format of the parameters was not valid
@@ -1871,9 +1875,12 @@ public:
@see remove()
*/
inline static RC create( const ::rtl::OUString& ustrDirectoryURL )
inline static RC create(
const ::rtl::OUString& ustrDirectoryURL,
sal_Int32 flags = osl_File_OpenFlag_Read | osl_File_OpenFlag_Write )
{
return static_cast< RC >( osl_createDirectory( ustrDirectoryURL.pData ) );
return static_cast< RC >(
osl_createDirectoryWithFlags( ustrDirectoryURL.pData, flags ) );
}
/** Remove an empty directory.