I am trying to understand the nature of the file system on watchOS (in particular the temporary directory), for the purpose of logging events in my long-running app. So far I have found out the following:
The temporaryDirectory URL looks like:
file:///private/var/mobile/Containers/Data/PluginKitPlugin/C46C4624-888D-4FBD-A125-894253D7ED2B/tmp
where the UUID embedded in the directory path changes for each build.
However, when I write to a log file ("log.txt")in that directory, I find that the file retains the data from build to build even though the UUID changes. So in one build, the log file URL directory is:
file:///private/var/mobile/Containers/Data/PluginKitPlugin/C46C4624-888D-4FBD-A125-894253D7ED2B/tmp/log.txt
and in the next build it is
file:///private/var/mobile/Containers/Data/PluginKitPlugin/FC472C31-9586-4880-9E72-3EECA372CAEF/tmp/log.txt
but the log data from the first build is retained in the second file!.
Coming only recently to watchOS from a long Unix and Windows background, I don't understand how a file in one directory can contain the same data as a file newly created in a different directory.