Merge lp:~paul-lucas/zorba/pjl-misc into lp:zorba

Proposed by Paul J. Lucas
Status: Merged
Approved by: Ghislain Fourny
Approved revision: 11245
Merged at revision: 11511
Proposed branch: lp:~paul-lucas/zorba/pjl-misc
Merge into: lp:zorba
Diff against target: 30 lines (+11/-8)
1 file modified
modules/org/expath/ns/file.xq.src/file.cpp (+11/-8)
To merge this branch: bzr merge lp:~paul-lucas/zorba/pjl-misc
Reviewer Review Type Date Requested Status
Ghislain Fourny Approve
Paul J. Lucas Approve
Review via email: mp+169221@code.launchpad.net

Commit message

Fix file::create-dir(): if the directory exists, do nothing.

Description of the change

Fix file::create-dir(): if the directory exists, do nothing.

To post a comment you must log in.
Revision history for this message
Paul J. Lucas (paul-lucas) :
review: Approve
Revision history for this message
Ghislain Fourny (gislenius) wrote :

Perfect, thanks Paul!

review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job pjl-misc-2013-06-13T15-43-43.672Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'modules/org/expath/ns/file.xq.src/file.cpp'
2--- modules/org/expath/ns/file.xq.src/file.cpp 2013-06-13 01:21:36 +0000
3+++ modules/org/expath/ns/file.xq.src/file.cpp 2013-06-13 14:38:46 +0000
4@@ -75,15 +75,18 @@
5 {
6 String const path( getPathArg( args, 0 ) );
7
8- if ( fs::get_type( path ) )
9+ fs::type const fs_type = fs::get_type( path );
10+ if ( !fs_type )
11+ try {
12+ fs::mkdir( path );
13+ }
14+ catch ( std::exception const &e ) {
15+ throw raiseFileError( "FOFL9999", e.what(), path );
16+ }
17+ else if ( fs_type != fs::directory )
18 raiseFileError( "FOFL0002", "file already exists", path );
19-
20- try {
21- fs::mkdir( path );
22- }
23- catch ( std::exception const &e ) {
24- throw raiseFileError( "FOFL9999", e.what(), path );
25- }
26+ else
27+ /* directory already exists: do nothing */;
28
29 return ItemSequence_t( new EmptySequence() );
30 }

Subscribers

People subscribed via source and target branches