Merge pull request #62 from wynwxst/main

[Minor Fix] Version system
This commit is contained in:
Stossy11 2025-04-02 18:21:57 +11:00 • committed by GitHub
commit dd17c0d0ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -49,31 +49,11 @@ func httpGet(_ urlString: String, result: @escaping (String?) -> Void){
}
func UpdateRetrieval() -> Bool{
let fileURL = URL.documentsDirectory.appendingPathComponent("version.txt")
if !fileManager.fileExists(atPath: fileURL.path) {
let urlString = "https://raw.githubusercontent.com/0-Blu/StikJIT/refs/heads/main/version.txt"
var FileContent: String = "";
httpGet(urlString) { result in
if let fc = result {
FileContent = fc
}
}
if (FileContent == ""){
do {
try FileContent.write(to: fileURL, atomically: true, encoding: .utf8)
print("Wrote to file successfully")
} catch {
print("Error writing to file: \(error)")
}
} else {
print("Failed to get version.txt, will try again later.")
}
var ver: String {
let marketingVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "1.0"
return marketingVersion
}
let ver = try! String(contentsOfFile: fileURL.path)
let urlString = "https://raw.githubusercontent.com/0-Blu/StikJIT/refs/heads/main/version.txt"
var res = false
httpGet(urlString) { result in