2020-12-08 21:33 阅读 0

Improve default Open/Save path

Hi, Most apps will default Open, Save and Download dialogs to the current directory. That is, if you type say "gimp" in a terminal, the current path will be used as the default when choose File -> Open dialog.

The XDG spec has certain variables that an app can read, at ~/.config/users-dirs.dirs, see here: https://wiki.archlinux.org/index.php/XDG_user_directories

...however, I haven't found any apps that read these.

mtpaint defaults to whatever the $HOME variable is, and also saves the .mtpaintrc file there. Users would like to have some control of the default, without .mtpaintrc also shifting, by one of the above methods.

Interestingly, inkscape also has this problem, but starting it with "HOME=some/path inkscape" still results in the configuration being created, for case of being logged in as root, at /root/.config/inkscape, while Open/Save dialogs default to "some/path" --- rather odd, but does give the user control. Anyway, I think the best choice for mtpaint is to do what most apps do, open at the current directory.

I am requesting this, as EasyOS has a need of it.


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

4条回答 默认 最新

  • weixin_39658716 weixin_39658716 2020-12-08 21:33

    Why no one ever reads the manual, is one of the most inscrutable secrets of the Universe. http://mtpaint.sourceforge.net/handbook/en_GB/chap_A.html#SEC64 This was about the .mtpaintrc location. Which, to summarize the content of apparently cursed by unreadness link above, can be changed by setting the "userINI" variable in global configfile /etc/mtpaint/mtpaintrc As for the default path, mtPaint's fileselector uses the user's home directory only on the first run; afterwards, the last used directory is remembered, and opened again (unless it got deleted, in which case it again defaults to homedir).

    If you need some specific different behaviour, I naturally can add it as either a pref, or a global config option.

    点赞 评论 复制链接分享
  • weixin_39964833 weixin_39964833 2020-12-08 21:33

    Ha ha, read the user manual, what an extraordinary suggestion! :)

    In EasyOS, I require all apps to default Open, Save and Download dialogs to a particular path, from the very first time the app is run. It is part of providing a seamless user experience.

    In EasyOS, the script that starts X, /usr/bin/xwin (same as Puppy), does a "cd" operation to set the current directory, and most apps will default to that for their Open/Save dialogs.

    Could you also detect the current directory and get mtPaint to default to that, instead of $HOME? Note, this is unlikely to upset other distros, as they will normally have their current directory set to $HOME when X is started.

    Or even better, read the XDG user path variables, I posted a link earlier. That will enable to set a specific path for images.

    点赞 评论 复制链接分享
  • weixin_39658716 weixin_39658716 2020-12-08 21:33

    If you're OK with directory still getting remembered & restored across sessions, then the simplest solution will be to put "last_dir = ." into the aforementioned global configfile. Or any other path, for that matter - either relative to the current dir, say "./graphics", or absolute like "/root/graphics" (user-relative ones like "~/graphics" are not recognized in that part of code at the moment).

    If you want mtPaint to default to the current dir every time it is run, on the other hand, I'll have to add a pref switch that disables "last_dir". Then, that pref could be set in the global config, the same way; the global config is for changing the initial defaults without patching the code itself.

    点赞 评论 复制链接分享
  • weixin_39964833 weixin_39964833 2020-12-08 21:33

    Thanks for that info, yes, "last_dir" does the trick for me!

    点赞 评论 复制链接分享