; $VER: GoldED Studio Uninstall 6.0.4 (11.06.99)

(delopts "oknodelete" "force" "askuser")

; -------------------------------- set strings ---------------------------------

(if (= @language "deutsch")

    (
        (set #studio_notfound "Es wurde keine vorhandene Installation gefunden !")

        (set #studio_uninstall

            (cat

                "Dieses Programm entfernt GoldED Studio von ihrem Computer !\n\n"

                "Verwenden Sie dieses Programm nur, wenn GoldED Studio komplett gelscht werden soll. Einzelne Komponenten knnen mit dem normalen Setup-Programm entfernt werden.\n\n"

                "Wir empfehlen die Verwendung diese Programms nur DIREKT NACH EINEM NEUSTART. Es sollten vorher keine anderen Programme gestartet worden sein.\n\n"
            )
        )

        (set #studio_uninstall_help "Das Studio-Verzeichnis und alle Unterverzeichnisse werden entfernt, wenn Sie fortfahren !")

        (set #studio_uninstall_uninstall "Fortfahren")

        (set #studio_uninstall_cancel "Abbrechen")

        (set #studio_confirm "Gefundene Installation: ")

        (set #studio_confirm_uninstall "Entfernen")

        (set #studio_confirm_cancel "Abbrechen")

        (set #studio_uninstalling "GoldED Studio wird entfernt ...")

        (set #studio_error "Deinstallation abgeschlossen. Es konnten nicht alle Komponenten entfernt werden. Beenden Sie alle Programme, starten Sie den Rechner neu und lschen Sie die verbleibenden Dateien.")
    )

    ; english strings

    (
        (set #studio_notfound "Es wurde keine vorhandene Installation gefunden !")

        (set #studio_uninstall

            (cat

                "This program removes GoldED Studio from your computer !\n\n"

                "Use this program to have GoldED Studio completely removed from your computer. Use the normal setup program to remove specific components.\n\n"

                "We recommend to use this program directly after a reboot only. No other programs should have been started before uninstallation.\n\n"
            )
        )

        (set #studio_uninstall_help "The Studio directory and all subdirectories are deleted if you proceed !")

        (set #studio_uninstall_uninstall "Proceed")

        (set #studio_uninstall_cancel "Cancel")

        (set #studio_confirm "Installation detected: ")

        (set #studio_confirm_cancel "Cancel")

        (set #studio_confirm_uninstall "Delete")

        (set #studio_uninstalling "Uninstalling ...")

        (set #studio_error "Uninstallation completed. Some files could not be removed. Terminate all programs, reboot your computer and delete the remaining files manually.")
    )
)

; ---------------------------------- uninstall ---------------------------------

(if (exists "golded:" (noreq))

    (
        (set uninstallpath (expandpath "golded:"))

        (set continue

            (askbool

                (prompt #studio_uninstall)

                (help #studio_uninstall_help)

                (choices

                    #studio_uninstall_uninstall
                    #studio_uninstall_cancel
                )

                (default 0)
            )
        )

        (if (= continue 1)

            (
                (set continue

                    (askbool

                        (prompt (cat #studio_confirm uninstallpath))

                        (help #studio_uninstall_help)

                        (choices

                              #studio_confirm_uninstall
                              #studio_confirm_cancel
                        )

                        (default 0)
                    )
                )

                (if (= continue 1)

                    (
                        (working #studio_uninstalling)

                        (run "run <>NIL: installdata/programs/stopgolded")

                        ; delete drawer symbol

                        (delete

                            (tackon uninstallpath ".info")
                        )

                        ; clean up startup sequence

                        (run "installdata/programs/stripstartup >NIL: LINES=6 SECTIONNAME=JOYCE")

                        (run "installdata/programs/stripstartup >NIL: LINES=6 SECTIONNAME=HiSpeed")

                        (run "installdata/programs/stripstartup >NIL: LINES=6 SECTIONNAME=GED_quick")

                        (run "installdata/programs/stripstartup >NIL: LINES=6 SECTIONNAME=GoldED")

                        ; get rid of active assigns pointing to golded directory

                        (run ("installdata/programs/remassigns >NIL: BASEDIR \"%s\"" uninstallpath))

                        ; delete root directory

                        (run ("installdata/programs/remdir >NIL: BASEDIR \"%s\"" uninstallpath))

                        (if (exists uninstallpath (noreq))

                            (message #studio_error)
                        )
                    )
                )
            )
        )

    )

    (message #studio_notfound)
)

(exit (quiet))

(welcome)

