zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #23121
[Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba
Paul J. Lucas has proposed merging lp:~paul-lucas/zorba/pjl-misc into lp:zorba.
Commit message:
Fix file::create-dir(): if the directory exists, do nothing.
Requested reviews:
Ghislain Fourny (gislenius)
Paul J. Lucas (paul-lucas)
For more details, see:
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/169221
Fix file::create-dir(): if the directory exists, do nothing.
--
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/169221
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'modules/org/expath/ns/file.xq.src/file.cpp'
--- modules/org/expath/ns/file.xq.src/file.cpp 2013-06-13 01:21:36 +0000
+++ modules/org/expath/ns/file.xq.src/file.cpp 2013-06-13 14:38:46 +0000
@@ -75,15 +75,18 @@
{
String const path( getPathArg( args, 0 ) );
- if ( fs::get_type( path ) )
+ fs::type const fs_type = fs::get_type( path );
+ if ( !fs_type )
+ try {
+ fs::mkdir( path );
+ }
+ catch ( std::exception const &e ) {
+ throw raiseFileError( "FOFL9999", e.what(), path );
+ }
+ else if ( fs_type != fs::directory )
raiseFileError( "FOFL0002", "file already exists", path );
-
- try {
- fs::mkdir( path );
- }
- catch ( std::exception const &e ) {
- throw raiseFileError( "FOFL9999", e.what(), path );
- }
+ else
+ /* directory already exists: do nothing */;
return ItemSequence_t( new EmptySequence() );
}
Follow ups