home *** CD-ROM | disk | FTP | other *** search
- /*
- * Config.c - Copyright © 1991 by S.R. & P.C.
- *
- * Created: 21 Feb 1991 18:18:36
- * Modified: 19 Jun 1991 18:18:13
- *
- * Make>> make
- */
-
- #include "Global.h"
- #include "proto/Config.h"
-
-
- extern struct BrowserWindow *CurrentWin;
- extern struct Config Config;
- extern struct ParMConfig ParMConfig;
- extern char *ReqTitle;
-
-
- void LoadConfig(void)
- {
- struct Config TmpCfg;
- BPTR fh;
- short bytes = 0;
-
- if (fh = Open(CONFIG_FILE, MODE_OLDFILE)) {
- bytes = Read(fh, (char *)&TmpCfg, sizeof(struct Config));
- Close(fh);
- if (bytes < sizeof(struct Config) || strcmp(TmpCfg.IdentString, BROWSER_IDENT_STRING)) {
- SimpleRequest(ReqTitle, CONFIG_FILE_ERROR_MSG, CONFIG_FILE);
- bytes = 0;
- }
- else {
- Config = TmpCfg;
- ParMConfig.SimpleCmdMode = Config.CmdMode;
- }
- }
- if (bytes == 0) { /* Set default flags */
- Config.CmdMode = ParMConfig.SimpleCmdMode = TRUE;
- Config.RunMode = RM_SHELL|RM_REQUEST;
- Config.Sort = NAME_SORT|TYPE_SORT;
- Config.CopyMode = CM_CONTEXT|CM_ASK_OVERWRITE|CM_COPY_HIERARCHY|CM_COPY_EMPTYDIRS;
- Config.CopyFlags = CF_CLONE;
- Config.Display = DLF_DIRS|DLF_VOLUMES;
- Config.Options = OPT_TOGGLESELECT|OPT_MOVEINTOSUB|OPT_ASKBEFOREMOVE|OPT_ASYNCHRONOUS;
- Config.Select.si_Flags = SI_MATCH_FILES|SI_MATCH_DIRS;
- Config.DefaultFilters.si_Flags = SI_ALL_FILES|SI_ALL_DIRS;
- }
- }
-
-
- void SaveConfig(void)
- {
- BPTR fh;
-
- strcpy(Config.IdentString, BROWSER_IDENT_STRING);
- Config.EntryInfoFlags = CurrentWin->bw_EntryInfoFlags;
- Config.Sort = CurrentWin->bw_Sort;
- Config.DefaultFilters = CurrentWin->bw_FiltersInfo;
- Config.DefaultFilters.si_Flags &= ~SI_INVERT;
-
- if (fh = Open(CONFIG_FILE, MODE_NEWFILE)) {
- Write(fh, (char *)&Config, sizeof(struct Config));
- Close(fh);
- }
- else
- SimpleRequest(ReqTitle, "Couldn't save configuration!");
- }
-
-
-