summaryrefslogtreecommitdiff
path: root/fileaccess
diff options
context:
space:
mode:
authorAndreas Bregas <ab@openoffice.org>2000-11-30 10:21:47 +0000
committerAndreas Bregas <ab@openoffice.org>2000-11-30 10:21:47 +0000
commit0bca7edb25bcffa29fdd3fe6d7c88249d75c1487 (patch)
treedd97ee40e4a5e79d7c42bad8c0676bdc628ffc25 /fileaccess
parent03fa2163de4d25b1e0adc1ccd0f312a2ab803cda (diff)
#80511# createFolder(): Also create parent folders if necessary
Diffstat (limited to 'fileaccess')
-rw-r--r--fileaccess/source/FileAccess.cxx16
1 files changed, 12 insertions, 4 deletions
diff --git a/fileaccess/source/FileAccess.cxx b/fileaccess/source/FileAccess.cxx
index 51bc37f8fd..1d54afd333 100644
--- a/fileaccess/source/FileAccess.cxx
+++ b/fileaccess/source/FileAccess.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: FileAccess.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: ab $ $Date: 2000-11-16 13:11:28 $
+ * last change: $Author: ab $ $Date: 2000-11-30 11:21:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -366,9 +366,17 @@ void OFileAccess::createFolder( const OUString& NewFolderURL )
// SfxContentHelper::MakeFolder
INetURLObject aURL( NewFolderURL, INET_PROT_FILE );
- String aNewFolderURLObj = aURL.GetMainURL();
+ String aNewFolderURLStr = aURL.GetMainURL();
String aTitle = aURL.getName();
aURL.removeSegment();
+
+ // Does the base folder exist? Otherwise create it first
+ String aBaseFolderURLStr = aURL.GetMainURL();
+ if( !isFolder( aBaseFolderURLStr ) )
+ {
+ createFolder( aBaseFolderURLStr );
+ }
+
Sequence<OUString> aNames(2);
OUString* pNames = aNames.getArray();
pNames[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) );
@@ -380,7 +388,7 @@ void OFileAccess::createFolder( const OUString& NewFolderURL )
Reference< XCommandEnvironment > aCmdEnv;
Content aCnt( aURL.GetMainURL(), aCmdEnv );
- Content aNewFolder( aNewFolderURLObj, aCmdEnv );
+ Content aNewFolder( aNewFolderURLStr, aCmdEnv );
OUString aType( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.sun.staroffice.fsys-folder" ) );
aCnt.insertNewContent( aType, aNames, aValues, aNewFolder );
}