Where to save stuff (in snap-agnostic way)

Jamie Strandboge jamie at canonical.com
Tue Feb 7 16:21:02 UTC 2017


On Tue, 2017-02-07 at 12:04 +0800, XiaoGuo Liu wrote:
> Hi Jamie,
> 
> For my sample app at https://github.com/liu-xiao-guo/helloworld-fifo, I
> tried to use the /tmp file to create a file, and  finally I get a file on
> my Desktop like:
> 
> root at liuxg:/tmp/snap.1000_snap.hello.fifo_TovLTW/tmp# ls
> anothefile
> 
> It seems to me that the path is still related to the command name "fifo".
> Does this conflict with your saying?

It does not. That directory is what is bind mounted into mount namespace and
that is remembered for subsequent invocations of that command or other commands
from the same snap. Try it: create a snap with two commands, have one create a
file in /tmp and another to read the same file in /tmp-- it will work and the
temporary directory in the system's /tmp will be
/tmp/snap.0_snap.$SNAP_NAME.<first invoked command>_... will have the file you
created in it.

-- 
Jamie Strandboge             | http://www.canonical.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/snapcraft/attachments/20170207/c84852b8/attachment.sig>


More information about the Snapcraft mailing list