查找可移植地存储应用程序数据的位置 [英] Finding where to store application data portably

查看:64
本文介绍了查找可移植地存储应用程序数据的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用pygame编写一款名为Bombz的游戏,它需要在与之关联的目录中保存一些

数据。在Unix / Linux中,我可能会在Windows中使用

"〜/ .bombz",例如

" C:\Documents And Settings \< ; user> \ Applicacation Data \ Bombz" ;.


该群组的档案中有很多关于如何找到正确位置的消息在Windows中,但是Mac OS呢?在那里我

根本不知道这种事情的正确位置。而且,
是其他更加模糊的系统,比如RISC OS(它可能没有pygame但是

它肯定有python)。当然,对于os或sys中的官方功能来说,这是一种哭泣的价值。


-

回复中的地址是真实的,不应编辑。

请参阅< http://www.realh.co.uk/contact.html>为了更可靠的联系

地址。

解决方案

Tony Houghton写道:

我''使用pygame编写一个名为Bombz的游戏,需要将一些数据保存在与之关联的目录中。在Unix / Linux中,我可能会在Windows中使用
〜/ .bombz,类似于
C:\Documents And Settings \< user> \ Applicacation Data \\ \\ Bombz"

这个小组的档案中有很多关于如何在Windows中找到正确位置的消息,但是Mac OS呢?在那里,我根本不知道这种事情的正确位置。还有其他更隐蔽的系统,比如RISC OS(它可能没有pygame,但它绝对有python)。当然,对于os或sys中的官方函数来说,这是一种哭泣。




在OS X上,数据可能应该转到

~ /图书馆/应用支持/ Bombz /

-

Robert Kern
rk *** @ ucsd.edu


在草地长高的地狱里
是否允许死亡的坟墓死亡。

- Richard Harter


Tony Houghton写道:


我正在使用pygame编写一个名为Bombz的游戏,它需要在与之关联的目录中保存一些
数据。在Unix / Linux中,我可能会在Windows中使用
〜/ .bombz,类似于
C:\Documents And Settings \< user> \ Applicacation Data \\ \\ Bombz"

这个小组的档案中有很多关于如何在Windows中找到正确位置的消息,但是Mac OS呢?在那里,我根本不知道这种事情的正确位置。还有其他更隐蔽的系统,比如RISC OS(它可能没有pygame,但它绝对有python)。当然,对于os或sys中的官方函数来说,这是一种哭泣。




也许使用import user;的user.home"会足够的。请注意

记录这样做的副作用。


-Peter


在星期二, 2005年9月20日23:03:52 +0100,Tony Houghton写道:

我正在使用pygame编写一款名为Bombz的游戏,需要保存一些
数据与之关联的目录。在Unix / Linux中,我可能会在Windows中使用
〜/ .bombz,类似于
C:\Documents And Settings \< user> \ Applicacation Data \\ \\ Bombz"。




在Windows中,你不应该对驱动器号进行硬编码。我不知道你是怎么回事
找出正确的值是什么,但硬编码就是坏了。


作为Linux用户,我真的厌倦了每个该死的应用程序,脚本和

程序在阳光下填充我的主目录的顶层与

点文件。


我希望Linux Standard Base人员指定设置文件

应该都进入像〜/ settings这样的子目录而不是填满

目录与cruft。在人们只用ls查看他们的文件的那些日子里,这是可以接受的,但是在GUI文件管理器的这些日子里,有超过100个是荒谬的我的主目录中的点文件和

目录。


<倾斜在风车>


我可以问开发人员打破过时和烦人的习惯

创建用户特定的配置文件为〜/ .app-name并使用

~ / settings / app-name代替?


< /倾斜在风车>

-

史蒂文。



I''m using pygame to write a game called Bombz which needs to save some
data in a directory associated with it. In Unix/Linux I''d probably use
"~/.bombz", in Windows something like
"C:\Documents And Settings\<user>\Applicacation Data\Bombz".

There are plenty of messages in the archives for this group about how to
find the correct location in Windows, but what about Mac OS? There I
don''t know the correct location for this sort of thing at all. And there
are other, more obscure systems like RISC OS (it may not have pygame but
it definitely has python). Surely this is something that''s crying out
for an official function in os or sys.

--
The address in the Reply-To is genuine and should not be edited.
See <http://www.realh.co.uk/contact.html> for more reliable contact
addresses.

解决方案

Tony Houghton wrote:

I''m using pygame to write a game called Bombz which needs to save some
data in a directory associated with it. In Unix/Linux I''d probably use
"~/.bombz", in Windows something like
"C:\Documents And Settings\<user>\Applicacation Data\Bombz".

There are plenty of messages in the archives for this group about how to
find the correct location in Windows, but what about Mac OS? There I
don''t know the correct location for this sort of thing at all. And there
are other, more obscure systems like RISC OS (it may not have pygame but
it definitely has python). Surely this is something that''s crying out
for an official function in os or sys.



On OS X, the data should probably go to
~/Library/Application Support/Bombz/

--
Robert Kern
rk***@ucsd.edu

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter


Tony Houghton wrote:


I''m using pygame to write a game called Bombz which needs to save some
data in a directory associated with it. In Unix/Linux I''d probably use
"~/.bombz", in Windows something like
"C:\Documents And Settings\<user>\Applicacation Data\Bombz".

There are plenty of messages in the archives for this group about how to
find the correct location in Windows, but what about Mac OS? There I
don''t know the correct location for this sort of thing at all. And there
are other, more obscure systems like RISC OS (it may not have pygame but
it definitely has python). Surely this is something that''s crying out
for an official function in os or sys.



Perhaps using "import user; user.home" would be adequate. Note the
documented side effects of doing that however.

-Peter


On Tue, 20 Sep 2005 23:03:52 +0100, Tony Houghton wrote:

I''m using pygame to write a game called Bombz which needs to save some
data in a directory associated with it. In Unix/Linux I''d probably use
"~/.bombz", in Windows something like
"C:\Documents And Settings\<user>\Applicacation Data\Bombz".



In Windows, you shouldn''t hard-code the drive letter. I don''t know how you
find out what the correct value is, but hard-coding it is just Bad.

As a Linux user, I really am sick of every damn application, script and
program under the sun filling the top level of my home directory with
dot-files.

I wish the Linux Standard Base folks would specify that settings files
should all go into a subdirectory like ~/settings rather than filling up
the home directory with cruft. That was acceptable in the days when people
only looked at their files with ls, but in these days of GUI file
managers, it is ridiculous that there are more than 100 dot files and
directories in my home directory.

<tilting at windmills>

Can I ask developers to break with the obsolete and annoying habit of
creating user-specific config files as ~/.app-name and use
~/settings/app-name instead?

</tilting at windmills>
--
Steven.


这篇关于查找可移植地存储应用程序数据的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆