Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Settings file inconsistency between linux and mac
Forum Updated to NodeBB v4.3 + New Features

Settings file inconsistency between linux and mac

Scheduled Pinned Locked Moved General and Desktop
5 Posts 5 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    johnmerlino
    wrote on last edited by
    #1

    running same program uses settings file in different locations between ubuntu and osx:

    ubuntu:
    Settings file: /home/guarddog/.config/GuardDog/Gateway.conf

    osx:
    Settings file: /Users/GuardDog/Library/Preferences/com.guarddog.Gateway.plist

    I understand the use of the domain for osx, as the qt documentation states the following: "When the Internet domain is set, it is used on Mac OS X instead of the organization name". That's fine, but why on mac is the settings file set in Library/Preferences folder and why does it have an extension plist?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Because by default QSettings uses the platform implementation thus in OS X it's a plist file located there

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • L Offline
        L Offline
        leon.anavi
        wrote on last edited by
        #3

        I suggest you to have a look at Platform-Specific Notes provided with the documentation of "QSettings":http://qt-project.org/doc/qt-5/qsettings.html
        If you can set a custom file format at constructor of QSettings or change the default format using the static method "setDefaultFormat(Format format)":http://qt-project.org/doc/qt-5/qsettings.html#setDefaultFormat

        http://anavi.org/

        1 Reply Last reply
        0
        • M Offline
          M Offline
          MuldeR
          wrote on last edited by
          #4

          @johnmerlino:

          Why would you want to store settings in the exactly same way on each platform, anyway? I think the idea is that QSettings provides an interface that allows your application store/load its settings in a platform-independent way. Internally, however, QSettings stores the settings in the way that is the usual and recommended one, for each platform. So on Windows it uses the Registry, on Mac OS X it uses a .plist file, and so on. But since these details are hidden inside QSettings, your application doesn't need to worry at all ;-)

          As others have said, you can force a specific method, if you really have to. But I think you shouldn't do that, unless you have a good reason...

          [quote]QSettings::NativeFormat

          Store the settings using the most appropriate storage format for the platform.[/quote]

          My OpenSource software at: http://muldersoft.com/

          Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

          Go visit the coop: http://youtu.be/Jay...

          1 Reply Last reply
          0
          • C Offline
            C Offline
            ChrisW67
            wrote on last edited by
            #5

            bq. Why would you want to store settings in the exactly same way on each platform, anyway?

            If you wanted to provide a mechanism in your program to backup settings and user data and restore it on any supported platform. You could go to the effort of providing a separate serialisation/deserialisation for the settings, but why bother if a simple INI file is nicely portable.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved