sorry i've done it directly without gambas ... the correction :
private sub CreateDirTree(sDir as string)
dim s as string
if sdir begins / then sdir = right(sdir,-1)
For each s in split(sDir, /)
sDir /= s
if exist(stmpdir) then continue
mkdir stmpdir
next
catch
Print The directory
@lists.sourceforge.net
Sent: Fri, 01 Jul 2011 10:21:31 +0200
Subject: Re: [Gambas-user] Try Catch fail when using mkdir
Hi Stephen,
my first thought was that it might be If Not Exist... I had such a case
some time ago, and it did not react as expected. Just check if it really
reports TRUE if the directory
Hi Stephen,
my first thought was that it might be If Not Exist... I had such a case
some time ago, and it did not react as expected. Just check if it really
reports TRUE if the directory isn't there. (I remember Benoit explained
why it didn't run correctly in my case, maybe you find the thread
This is the good way in your way ... but it's a bad way in my fill
Private Sub CreateNewOutputFolder(sFolderSpec As String)
If Not Exist(sFolderSpec) Then Mkdir sFolderSpec
Catch
'if problem try on the prec folder
CreateNewOutputFolder(File.Dir(sFolderSpec))
'Re Try the folder
-user] Try Catch fail when using mkdir
Hi Stephen,
my first thought was that it might be If Not Exist... I had such a case
some time ago, and it did not react as expected. Just check if it really
reports TRUE if the directory isn't there. (I remember Benoit explained
why it didn't run
Greetings Fabien!
That works very well, and is so much smaller and cleaner than the SUB
you put in the initial email. By the way, that first SUB would have had
a problem creating the stmpDir folder, it would, as written, not put in
the delimiting / characters and would try to create a
eilert-sprac...@t-online.de
To: gambas-user@lists.sourceforge.net
Sent: Fri, 01 Jul 2011 10:21:31 +0200
Subject: Re: [Gambas-user] Try Catch fail when using mkdir
Hi Stephen,
my first thought was that it might be If Not Exist... I had such a case
some time ago, and it did not react
Hi folks!
Gambas 2.99
Fedora 14
Using mkdir with catch and finally to create a recursive SUB to
build a directory structure.
The harness consists of FormMain with one big-friendly button on it,
pretty simple. Here is all of the code;
' Gambas class file
Public Sub _new()
End
Public
hi,
Hi folks!
Gambas 2.99
Fedora 14
Using mkdir with catch and finally to create a recursive SUB to
build a directory structure.
The harness consists of FormMain with one big-friendly button on it,
pretty simple. Here is all of the code;
' Gambas class file
Public Sub
The FINALLY part is not mandatory. If there is a catch part in the
function, the FINALLY part must precede it.
http://gambasdoc.org/help/lang/finally
The second call will be in the catch part not in finally.
2011/6/30 Stephen Bungay sbun...@csolve.net:
Hi folks!
Gambas 2.99
Fedora 14
private sub CreateDirTree(sDir as string)
dim s as string
dim stmpDir as string = /
if sdir begins / then sdir = right(sdir,-1)
For each s in split(sDir, /)
stmpDir = s
if exist(stmpdir) then continue
mkdir stmpdir
next
catch
Print The directory stmpdir can't be
Hi Fabien Tobias;
Thanks for taking the time to reply and putting those SUBs together.
Another way to do this is to simply execute a mkdir -p using the
command shell, but now that the problem exists I want to figure out why
the recursive routine is not behaving as expected.
Typo in the Finally section... Exists(sFolderSpec) should read
Exist(sFolderSpec).
On 06/30/2011 11:58 PM, Stephen Bungay wrote:
Hi Fabien Tobias;
Thanks for taking the time to reply and putting those SUBs together.
Another way to do this is to simply execute a mkdir -p using
13 matches
Mail list logo