05 December 2023, 18:16 | #1 |
Registered User
Join Date: Jun 2020
Location: Germany
Posts: 370
|
VERSION test for EXACT version only?
Hi,
I currently have some issues with the VERSION command and its capability to test for a specific version. As far as I understand it, it is not possible to test for an exact version only. Since it will return 0 when the version is equal or greater, or it will return 5 otherwise. Lets use the IPrefs.pch from MMULib as example, which bumps the version number of an WB 3.1 IPrefs from 40.7 to 40.8. Normal something like this would work: Code:
VERSION >NIL: C:IPrefs 40 REVISION 7 IF NOT WARN "Correct Version. Patch it." ELSE "Wrong Version. Do nothing" ENDIF It becomes even more annoying when I want to test for a version and the update uses a lower version number. For example the RAR client in XAD, the included one is v2.5, the updated/better one is v1.7. So, I'm basically looking for a way to test for a specific version only and then do something. And I don't want to nest up multiple checks to accomplish that. My only idea would be to redirect the output of VERSION to a file and then use something like SEARCH to test for the exact version. Or use some third party commands to get the version into a variable and then test that. |
05 December 2023, 18:34 | #2 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
What about something like :
Code:
if "`version c:iprefs`" eq "iprefs 40.7" "Correct Version. Patch it." else "Wrong Version. Do nothing" endif |
05 December 2023, 19:24 | #3 |
Registered User
Join Date: Jun 2020
Location: Germany
Posts: 370
|
I was looking at DoVer which has something similar to LFORMAT and can be set to just the version number. But that only works for DoVer's function to write the output as filenote. The STDOUT still contains the filename, but I thought of using that like you did.
Good to see that I don't need an extra tool for that. It's still a bit annoying that I have to input the filename, but I guess it's the best I can get. Thanks. |
05 December 2023, 22:23 | #4 |
Registered User
Join Date: Oct 2023
Location: Castel Goffredo / Mantova / Italy
Posts: 34
|
If it can help you, I use this in my theme:
Version exec.library version 47 >NIL: If Warn echo "*e[>1m*e[32;41m*e[0;20H*e[J" echo "-------------------------------------------------------------" echo "Kickstart 3.2 and AmigaOS 3.2x are required for this to work." echo "-------------------------------------------------------------" |
06 December 2023, 00:11 | #5 |
Registered User
Join Date: Jun 2020
Location: Germany
Posts: 370
|
I appreciate it but it is not good enough for my current project to detect the Kickstart version.
The solution from menynaf seems to work fine for now. |
06 December 2023, 11:12 | #6 |
Registered User
Join Date: Oct 2023
Location: Castel Goffredo / Mantova / Italy
Posts: 34
|
|
06 December 2023, 14:10 | #7 |
Registered User
Join Date: Oct 2021
Location: England
Posts: 1,180
|
i tried this
Code:
.KEY FILE IF Exists <FILE> SET VERSION `VERSION <FILE>` Failat 21 SKIP >NIL: "$VERSION" Failat 20 Else Echo "Need a Valid File To Check..." Endif ; Do Something When Specific Version Found LAB "IPrefs 40.7" Echo "Found 40.7" SKIP END LAB "IPrefs 47.29" Echo "Found 47.29" SKIP END LAB "UNKNOWN" ; Do Something When No Matching Version Found Echo "Unexpected Version Found..." LAB END Echo "" VERTEST C:IPREFS when it finds 1 specific version, it will do what you want, if it finds another specific version you can again do whatever, i have a LAB for an unexpected/unspecified result but i am not sure how to skip to it, the method i used is to SKIP to the version number, if that version has no corresponding LAB then a failcode 10 occurs, i assumed adding a SKIP "UNKNOWN" directly under SKIP >NIL: "$VERSION" that would have the script move to LAB "UNKNOWN" however it doesnt seem to do that and just runs to the end of the script doing nothing, so i have messed up something simple most likely. |
06 December 2023, 18:40 | #8 |
Registered User
Join Date: Jun 2020
Location: Germany
Posts: 370
|
Looks interesting. I probably would use something similar if we could create functions in shell scripts like in a bash script. I mean I could create a temporary script file somewhere in PATH to simulate that, but I think it would be overkill.
I have already scrapped the project where I needed this, but I still think I might use in an older project. And if I remember correctly, I never had the need to detect more than two different versions of the same file. Which is why menynafs solution would also be more compact. But yeah, thanks for the input. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Necronom - Amiga - Test Version? | miga | support.Games | 10 | 20 March 2024 14:12 |
Test Drive II: Whdload version including the Germany scenery disk? | emuola | project.WHDLoad | 3 | 14 March 2020 18:38 |
-Test Drive III Amiga version | Drummerboy | support.Games | 6 | 01 May 2011 02:44 |
CDTV CD drive version test request | Toni Wilen | request.Other | 2 | 04 November 2007 14:57 |
Old version number? [GameBase version vs. GBA version + misc. questions] | wanderer | project.GameBase Amiga | 5 | 23 August 2007 00:51 |
|
|