Catalog Problems
Posted: Tue Aug 20, 2024 7:28 pm
Hi to all !
I just done a little program that recognize the system language and try to select and open the correct catalog, in this case italian.
I think that there is some problems with the file becouse the program give the correct results in debug shell.
The error is:
Cannot open the catalog file
The directory tree is this one:
AmiWORP-Gate/Catalogs/italian/AmiWORP-Gate.catalog
This is the catalog content (Hollywood version, normal text UTF-8 format) without minus ofc:
----------------------------
Errore: l'eseguibile deve essere nella cartella AmiWORP-Gate !!!
Il programma si chiuderà in:
secondi
secondo
Abbiamo rilevato che la lingua di sistema è impostata su:
Confermi l'uso di questa lingua?
Vuoi cambiare la lingua?
----------------------------
The editor's text is this:
----------------------------
Function LinguaDefault()
; Rileva la lingua di sistema
SystemLang = GetSystemLanguage()
SystemLangInfo = GetLanguageInfo(SystemLang)
DebugPrint("Lingua di sistema rilevata: " .. SystemLangInfo.Name .. " (" .. SystemLangInfo.Code .. ")")
; Costruisci il percorso del catalogo in base alla lingua di sistema
catalogPath$ = "Catalogs/" .. SystemLangInfo.Name .. "/AmiWORP-Gate.catalog"
DebugPrint("Percorso del catalogo: " .. catalogPath$)
; Verifica se il catalogo esiste
If Exists(catalogPath$)
DebugPrint("Catalogo trovato. Provo ad aprirlo...")
; Tenta di aprire il catalogo
If OpenCatalog("AmiWORP-Gate.catalog") = True
DebugPrint("Catalogo aperto con successo.")
Else
DebugPrint("Impossibile aprire il catalogo.")
EndIf
Else
DebugPrint("Catalogo non trovato.")
EndIf
EndFunction
Function Main()
DebugPrint("Avvio del programma...")
; Esegui la funzione per selezionare la lingua
LinguaDefault()
; Ottieni la directory corrente
RootDir$ = GetCurrentDirectory()
DebugPrint("Directory corrente: " .. RootDir$)
; Verifica se la directory corrente termina con "AmiWORP-Gate"
ExpectedDir$ = "AmiWORP-Gate"
ActualDirEnd$ = RightStr(RootDir$, StrLen(ExpectedDir$))
If ActualDirEnd$ = ExpectedDir$
DebugPrint("La directory corrente è corretta.")
RootDirEsito = True
Else
DebugPrint("La directory corrente NON è corretta.")
RootDirEsito = False
EndIf
; Se la directory non è corretta, mostra un messaggio di errore
If Not RootDirEsito
; Creazione del display per il messaggio di errore
CreateDisplay(2, {Width = 640, Height = 480, Title = "Errore di Directory"})
DebugPrint("Display creato per il messaggio di errore.")
; Mostra il messaggio di errore all'utente
TextOut(#CENTER, #CENTER - 20, "Errore: l'eseguibile deve essere nella cartella AmiWORP-Gate.")
TextOut(#CENTER, #CENTER, "Il programma si chiuderà in:")
DebugPrint("Messaggio di errore mostrato.")
; Avvia un conto alla rovescia
For i = 5 To 1 Step -1
; Cancella l'intera area del testo precedente
SetFillStyle(#FILLCOLOR)
Box(#CENTER, #CENTER + 30, 100, 40, #BLACK)
; Scrivi il countdown
TextOut(#CENTER, #CENTER + 20, i)
; Modifica la scritta "secondi" o "secondo" in base al valore di i
If i = 1
TextOut(#CENTER, #CENTER + 40, "secondo")
Else
TextOut(#CENTER, #CENTER + 40, "secondi")
EndIf
Wait(50)
Next
; Chiudi il display e termina il programma
FreeDisplay(2)
End
EndIf
DebugPrint("Fine del controllo della cartella di root.")
EndFunction
; Avvio del programma principale
Main()
----------------------------
Any idea ?
Thanx to all !
bySpawnPPC
I just done a little program that recognize the system language and try to select and open the correct catalog, in this case italian.
I think that there is some problems with the file becouse the program give the correct results in debug shell.
The error is:
Cannot open the catalog file
The directory tree is this one:
AmiWORP-Gate/Catalogs/italian/AmiWORP-Gate.catalog
This is the catalog content (Hollywood version, normal text UTF-8 format) without minus ofc:
----------------------------
Errore: l'eseguibile deve essere nella cartella AmiWORP-Gate !!!
Il programma si chiuderà in:
secondi
secondo
Abbiamo rilevato che la lingua di sistema è impostata su:
Confermi l'uso di questa lingua?
Vuoi cambiare la lingua?
----------------------------
The editor's text is this:
----------------------------
Function LinguaDefault()
; Rileva la lingua di sistema
SystemLang = GetSystemLanguage()
SystemLangInfo = GetLanguageInfo(SystemLang)
DebugPrint("Lingua di sistema rilevata: " .. SystemLangInfo.Name .. " (" .. SystemLangInfo.Code .. ")")
; Costruisci il percorso del catalogo in base alla lingua di sistema
catalogPath$ = "Catalogs/" .. SystemLangInfo.Name .. "/AmiWORP-Gate.catalog"
DebugPrint("Percorso del catalogo: " .. catalogPath$)
; Verifica se il catalogo esiste
If Exists(catalogPath$)
DebugPrint("Catalogo trovato. Provo ad aprirlo...")
; Tenta di aprire il catalogo
If OpenCatalog("AmiWORP-Gate.catalog") = True
DebugPrint("Catalogo aperto con successo.")
Else
DebugPrint("Impossibile aprire il catalogo.")
EndIf
Else
DebugPrint("Catalogo non trovato.")
EndIf
EndFunction
Function Main()
DebugPrint("Avvio del programma...")
; Esegui la funzione per selezionare la lingua
LinguaDefault()
; Ottieni la directory corrente
RootDir$ = GetCurrentDirectory()
DebugPrint("Directory corrente: " .. RootDir$)
; Verifica se la directory corrente termina con "AmiWORP-Gate"
ExpectedDir$ = "AmiWORP-Gate"
ActualDirEnd$ = RightStr(RootDir$, StrLen(ExpectedDir$))
If ActualDirEnd$ = ExpectedDir$
DebugPrint("La directory corrente è corretta.")
RootDirEsito = True
Else
DebugPrint("La directory corrente NON è corretta.")
RootDirEsito = False
EndIf
; Se la directory non è corretta, mostra un messaggio di errore
If Not RootDirEsito
; Creazione del display per il messaggio di errore
CreateDisplay(2, {Width = 640, Height = 480, Title = "Errore di Directory"})
DebugPrint("Display creato per il messaggio di errore.")
; Mostra il messaggio di errore all'utente
TextOut(#CENTER, #CENTER - 20, "Errore: l'eseguibile deve essere nella cartella AmiWORP-Gate.")
TextOut(#CENTER, #CENTER, "Il programma si chiuderà in:")
DebugPrint("Messaggio di errore mostrato.")
; Avvia un conto alla rovescia
For i = 5 To 1 Step -1
; Cancella l'intera area del testo precedente
SetFillStyle(#FILLCOLOR)
Box(#CENTER, #CENTER + 30, 100, 40, #BLACK)
; Scrivi il countdown
TextOut(#CENTER, #CENTER + 20, i)
; Modifica la scritta "secondi" o "secondo" in base al valore di i
If i = 1
TextOut(#CENTER, #CENTER + 40, "secondo")
Else
TextOut(#CENTER, #CENTER + 40, "secondi")
EndIf
Wait(50)
Next
; Chiudi il display e termina il programma
FreeDisplay(2)
End
EndIf
DebugPrint("Fine del controllo della cartella di root.")
EndFunction
; Avvio del programma principale
Main()
----------------------------
Any idea ?
Thanx to all !
bySpawnPPC