Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions PureBasicIDE/CompilerInterface.pb
Original file line number Diff line number Diff line change
Expand Up @@ -2500,6 +2500,10 @@ Procedure Compiler_BuildTarget(SourceFileName$, TargetFileName$, *Target.Compile
Command$ + Chr(9) + "DLL"
EndIf

CompilerIf Not #SpiderBasic
CreateDirectoryRecursive(GetPathPart(TargetFileName$))
CompilerEndIf

CompilerWrite(Command$)

; We need the *ActiveSource for HandleCompilerResponse if the mainfile option is set
Expand Down
1 change: 1 addition & 0 deletions PureBasicIDE/Declarations.pb
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ Declare.s UniqueFilename(File$) ; return a unique representa
Declare IsEqualFile(File1$, File2$) ; returns true if the 2 filenames identify the same file
Declare.s CreateRelativePath(BasePath$, FileName$) ; turn the full path FileName$ into a relative one to BasePath$
Declare.s ResolveRelativePath(BasePath$, FileName$) ; merge a base path and a relative path to a full path
Declare CreateDirectoryRecursive(Directory$) ; create a directory and its parent directories, recursively if necessary

;- GotoWindow.pb
;
Expand Down
23 changes: 23 additions & 0 deletions PureBasicIDE/FileSystem.pb
Original file line number Diff line number Diff line change
Expand Up @@ -275,3 +275,26 @@ Procedure.s ResolveRelativePath(BasePath$, FileName$)
ProcedureReturn UniqueFilename(FileName$)
EndProcedure

Procedure CreateDirectoryRecursive(Directory$)
If Directory$ <> ""
Select FileSize(Directory$)
Case -2 ; already exists - OK!
ProcedureReturn #True

Case -1 ; does not exist - create it
Parent$ = UniqueFilename(Directory$ + #Separator + ".." + #Separator)
If Parent$ <> ""
CreateDirectoryRecursive(Parent$)
EndIf
CreateDirectory(Directory$)
If FileSize(Directory$) = -2
ProcedureReturn #True
EndIf

Default ; it's a file!
ProcedureReturn #False
EndSelect
EndIf
ProcedureReturn #False
EndProcedure