Compiler function: FileExists()

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Sicro
Enthusiast
Enthusiast
Posts: 559
Joined: Wed Jun 25, 2014 5:25 pm
Location: Germany
Contact:

Compiler function: FileExists()

Post by Sicro »

We need a compiler function to check if a file exists.
Otherwise, I see no possibility to solve the following problem without such a function:

Code: Select all

CompilerIf FileExists("/usr/lib/x86_64-linux-gnu/libwebkitgtk-3.0.so.0")
  ; Debian Linux
  #WEBKIT_LIB_PATH$ = "/usr/lib/x86_64-linux-gnu/libwebkitgtk-3.0.so.0"
CompilerElseIf FileExists("/usr/lib/libwebkitgtk-3.0.so.0")
  ; Arch Linux
  #WEBKIT_LIB_PATH$ = "/usr/lib/libwebkitgtk-3.0.so.0"
CompilerEndIf

ImportC #WEBKIT_LIB_PATH$
  ; ...
EndImport
Image
Why OpenSource should have a license :: PB-CodeArchiv-Rebirth :: Pleasant-Dark (syntax color scheme) :: RegEx-Engine (compiles RegExes to NFA/DFA)
Manjaro Xfce x64 (Main system) :: Windows 10 Home (VirtualBox) :: Newest PureBasic version
User avatar
skywalk
Addict
Addict
Posts: 4211
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Compiler function: FileExists()

Post by skywalk »

Yes, something similar to Zig's build language.
Automation is your friend. :)
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Post Reply