Skip to content

Commit 4f225d2

Browse files
committed
fix create directory chain. close #3
1 parent 83e56db commit 4f225d2

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed

sc.all.cls

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,20 @@ ClassMethod import(qspec = "cku-d", ByRef err = "", recurse = 1, ByRef loaded =
117117
/// Translate ( codename ) into ( filename )
118118
ClassMethod filename(code)
119119
{
120+
#define log(%dir,%sc) w !, "mkdir ", %dir, " ", %sc
120121
s wd = ..workdir()
121-
d:'##class(%File).DirectoryExists( wd ) ##class(%File).CreateDirectoryChain( wd )
122+
if '##class(%File).DirectoryExists( wd ) {
123+
s sc = ##class(%File).CreateDirectoryChain( wd )
124+
$$$log(wd,sc)
125+
}
122126
s filename = ##class(%File).NormalizeFilename( code, wd )
123127
#; for *.dfi filename can contain folders
124128
s path = ##class(%File).GetDirectory(filename)
125-
d:'##class(%File).DirectoryExists( path ) ##class(%File).CreateDirectoryChain( path )
129+
if '##class(%File).DirectoryExists( path ) {
130+
s sc=##class(%File).CreateDirectoryChain(path)
131+
$$$log(path,sc)
132+
}
133+
126134
Q filename
127135
}
128136

sc.all.sub.cls

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,32 @@ Class sc.all.sub Extends sc.all
77
/// etc
88
ClassMethod filename(code)
99
{
10+
#define log(%dir,%sc) w !, "mkdir ", %dir, " ", sc
11+
12+
s wd = ..workdir()
13+
14+
if '##class(%File).DirectoryExists( wd ) {
15+
s sc = ##class(%File).CreateDirectoryChain( wd )
16+
$$$log(wd,sc)
17+
}
18+
1019
s ext = $p( code, ".", * ), ext = $zcvt( ext, "l" )
1120
#; for each type - different directory
12-
s wd = ..workdir() s:ext'="" wd = ##class(%File).NormalizeDirectory( ext, wd )
13-
d:'##class(%File).DirectoryExists( wd ) ##class(%File).CreateDirectoryChain( wd )
21+
22+
s:ext'="" wd = ##class(%File).NormalizeDirectory( ext, wd )
23+
if '##class(%File).DirectoryExists( wd ) {
24+
s sc = ##class(%File).CreateDirectoryChain( wd )
25+
$$$log(wd,sc)
26+
}
1427

1528
s filename = ##class(%File).NormalizeFilename( code, wd )
1629
#; for *.dfi filename can contain folders
1730
if ext = "dfi" {
1831
s path = ##class(%File).GetDirectory( filename )
19-
d:'##class(%File).DirectoryExists( path ) ##class(%File).CreateDirectoryChain( path )
32+
if '##class(%File).DirectoryExists( path ) {
33+
s sc = ##class(%File).CreateDirectoryChain( path )
34+
$$$log(path,sc)
35+
}
2036
}
2137
Q filename
2238
}

0 commit comments

Comments
 (0)