Ticket #8245: config-read-only.diff

File config-read-only.diff, 1.8 KB (added by eriktorbjorn, 17 years ago)

Patch against a June 5 CVS snapshot

  • scummvm/common/config-file.cpp

    diff -ur ScummVM-cvs20030605/scummvm/common/config-file.cpp ScummVM-cvs20030605+hack/scummvm/common/config-file.cpp
    old new  
    4545// The config-class itself.
    4646
    4747Config::Config (const String &cfg, const String &d)
    48  : filename(cfg), defaultDomain(d), willwrite(false) {
     48 : filename(cfg), defaultDomain(d), willwrite(false), readonly(false) {
    4949        FILE *cfg_file;
    5050        char t[MAXLINELEN];
    5151
     
    218218        }
    219219}
    220220
     221void Config::set_readonly(bool r) {
     222        readonly = r;
     223}
     224
    221225void Config::set_writing(bool w) {
     226        if (readonly)
     227                w = false;
    222228        willwrite = w;
    223229}
    224230
  • scummvm/common/config-file.h

    diff -ur ScummVM-cvs20030605/scummvm/common/config-file.h ScummVM-cvs20030605+hack/scummvm/common/config-file.h
    old new  
    5151        bool has_domain(const String &d) const;
    5252        void set_filename(const String &);
    5353        void merge_config(const Config &);
     54        void set_readonly(bool);
    5455        void set_writing(bool);
    5556
    5657        const int count_domains();
     
    6162        String filename;
    6263        String defaultDomain;
    6364
     65        bool readonly;
    6466        bool willwrite;
    6567};
    6668
  • scummvm/common/main.cpp

    diff -ur ScummVM-cvs20030605/scummvm/common/main.cpp ScummVM-cvs20030605+hack/scummvm/common/main.cpp
    old new  
    178178
    179179        // Read the config file
    180180        g_config = new Config(scummhome, "scummvm");
     181        g_config->set_readonly(g_config->getBool("read_only"));
    181182        g_config->set("versioninfo", SCUMMVM_VERSION);
    182183
    183184        // Parse the command line information