On Fri, 8 Oct 2010, Sven Barth wrote:

Am 08.10.2010 10:03, schrieb Michael Van Canneyt:


On Fri, 8 Oct 2010, Sven Barth wrote:

Am 07.10.2010 20:02, schrieb Jonathan:
On Thu, 07 Oct 2010 11:01:44 +0200
Sven Barth<pascaldra...@googlemail.com> wrote:

Btw: What are Tomoyo and Apparmour (I can imagine what the second one
is, but I don't know what functionality they provide)?

http://tomoyo.sourceforge.jp/
https://wiki.ubuntu.com/AppArmor

Thanks.

So when changing/improving GetTempFileName we could also try to make
it compatible to such applications by creating a directory in TEMP for
the temporary file that contains the appname and the user.

The current implementation does just that. It uses GetTempDir which checks
TEMP and TMP (in that order), and if neither is set, uses /tmp.

Note also that you can hook in the temporary filename mechanism by setting
OnGetTempFile and doing it all yourself.

I'm aware of that (btw: is this OnGetTempFile possible on Windows as well?).

It should be ?

:)

But maybe we can use by default something like the following if HAS_GETTEMPFILENAME is not set (pseudo code):

if OnGetTempFilename <> Nil then
 OnGetTempFilename(Prefix)
else begin
 dir := FindTempDir + PathDelim + GetAppName + '-' + GetUserName;
 CreateTempFileInDir(dir, Prefix);
end;

* FindTempDir searches for a suitable environment var (TEMP, TMP, /tmp)
* GetAppName uses the GetAppName that is used for GetConfigDir as well (might be named differently, I'm not looking at the source currently) * GetUserName returns the name of the current logged on user (could be empty if the username can not be found)

There is no user name info; at most the UID can be retrieved.

Secondly, the fallback should work on all platforms, so username etc. are
not relevant.

We're discussing a unix solution, so this will be implemented for unix only.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to