The new resource command line param will only work on the latest version.
So using PBDev and a user having an older version, how can i determine what version he uses?
I ever mentioned it, isn't time there is a versioninfo block in the compiler or so?
Even a simple textfile would do.
Again, wish for determing compiler version.
-
Edwin Knoppert
- Addict

- Posts: 1073
- Joined: Fri Apr 25, 2003 11:13 pm
- Location: Netherlands
- Contact:
The new compiler has a /VERSION switch, that prints the version of the compiler. (sorry, forgot to add it to the helpfile)
If you use this switch on an older version, you will get "/VERSION: Unknown switch"
here is some code to read it:
If you use this switch on an older version, you will get "/VERSION: Unknown switch"
here is some code to read it:
Code: Select all
Procedure.s GetCompilerVersion(Compiler$)
securityattrib.SECURITY_ATTRIBUTES\nLength = SizeOf(SECURITY_ATTRIBUTES)
securityattrib\bInheritHandle = 1
securityattrib\lpSecurityDescriptor = 0
*Buffer = AllocateMemory(500)
If *Buffer And CreatePipe_(@hReadPipe, @hWritePipe, @securityattrib, 0)
info.STARTUPINFO\cb = SizeOf(STARTUPINFO)
info\dwFlags = #STARTF_USESHOWWINDOW | #STARTF_USESTDHANDLES
info\hStdOutput = hWritePipe
If CreateProcess_(0, Chr(34)+Compiler$+Chr(34)+" /VERSION", @securityattrib, @securityattrib, 1, #NORMAL_PRIORITY_CLASS, 0, 0, @info, @process.PROCESS_INFORMATION)
CloseHandle_(hWritePipe)
Repeat
; we must read as long as there is data, even when we need only the first line
result = ReadFile_(hReadPipe, *Buffer, 500, @bytesread, 0)
If bytesread > 0
Version$ = StringField(PeekS(*Buffer, bytesread), 1, Chr(13))
EndIf
Until result = 0
CloseHandle_(process\hProcess)
CloseHandle_(process\hThread)
CloseHandle_(hReadPipe)
EndIf
FreeMemory(*Buffer)
EndIf
ProcedureReturn Version$
EndProcedure
Debug GetCompilerVersion("C:\PureBasic\Compilers\PBCompiler.exe")
quidquid Latine dictum sit altum videtur
-
Edwin Knoppert
- Addict

- Posts: 1073
- Joined: Fri Apr 25, 2003 11:13 pm
- Location: Netherlands
- Contact:
