Command "file mkdir" doesnt return value and so cannot be nested.

Command "file mkdir" doesnt return value and so cannot be nested.

Post by Donal K. F » Thu, 31 Dec 2009 17:16:16



If you pass in a value that's come out of [file normalize] then that's
exactly what it will have created (assuming it succeeds; exception if
not).

set dirname [file normalize ~/testdir]
file mkdir $dirname

Donal.
 
 
 

Command "file mkdir" doesnt return value and so cannot be nested.

Post by iand » Thu, 31 Dec 2009 17:44:17

On Dec 30, 1:16m, "Donal K. Fellows"


> set dirname [file normalize ~/testdir] >> file mkdir $dirname> >> > Donal.


Donal,
The command works fine with relative paths. All i am trying to do is,
nest it.
Command "file mkdir" creates directory, but it does'nt return the
value it is expected to when it is nested as shown below. It should
either be returning directory name or normalized path to the directory
it creates, but returns a null value.
Is the behaviour expected? how to get the normalized path to the
directory it creates.

Ex:
% set dirname [file mkdir ~/testdir]
% puts $dirname

%

The variable 'dirsname' contains null value.

Cheers

 
 
 

Command "file mkdir" doesnt return value and so cannot be nested.

Post by Donal K. F » Thu, 31 Dec 2009 18:32:52


Well, I hope you want the empty string. This is because [file mkdir]
returns the empty string on success. Many commands do that.

Donal.
 
 
 

Command "file mkdir" doesnt return value and so cannot be nested.

Post by slebetma » Thu, 31 Dec 2009 20:42:58


> > set dirname [file normalize ~/testdir] >>>> file mkdir $dirname> >> > > Donal.> >> > Donal,> > The command works fine with relative paths. All i am trying to do is,> > nest it.> > Command "file mkdir" creates directory, but it does'nt return the> > value it is expected to when it is nested as shown below. It should> > either be returning directory name or normalized path to the directory> > it creates, but returns a null value.> > Is the behaviour expected? how to get the normalized path to the> > directory it creates.> >> > Ex:> > % set dirname [file mkdir ~/testdir]> > % puts $dirname> >> > %> >> > The variable 'dirsname' contains null value.> >> > Cheers

Why would you want to nest mkdir? If you want to create subdirectories
for example ~/testdir/subdir/subsubdir then just do:

file mkdir ~/testdir/subdir/subsubdir