On 07/01/2020 08:43, Martin Sluka via Therion wrote:
> 
>> 6. 1. 2020 v 10:14, Tarquin Wilton-Jones via Therion <therion@speleo.sk>:
>>
>> When .xtherion.dat has the "Hidden" flag set, Therion thinks it cannot
>> write to it (even though it actually can, since the Read-Only flag is
>> not set), so it doesn't output anything to that file, and throws an
>> error. The error has the wrong message, since it claims not to be able
>> to create Plan.thconfig.xth, when it actually did create that temporary
>> file just fine.
> 
> Didn’t the older versions of Therion use the same way to create .xtherion.dat 
> file on Windows systems? If so rather it looks as Windows changed the 
> permission to write to some files. Therion may do only what the operating 
> system allows to it.


I don't think this is a Windows mistake. I can edit a "hidden" file in
my text editor and save it. I cannot save a "read-only" file in my text
editor. So the metadata seems to be working correctly on Windows.
Therion is the only program I have which thinks it cannot write to a
"hidden" file.

This might be a limitation in Tcl/Tk's methods for opening a file. (MFC
has a similar problem with CFile::Open in C++, for example.) Maybe it
expects you to open an *existing* file using the same attributes as it
already has. So if a file exists and is "hidden" and you try to open a
file write stream without "hidden", it might refuse since the file
exists without that attribute.

The solution here would be either:

if file_exists(filename)
  foo = open_file_with_attributes(filename,'w',get_attributes(filename))
else
  foo = open_file(filename,'w')

or:

foo = open_file(filename,'w')
if !foo
  foo = open_file_with_attributes(filename,'w',hidden)

But of course, I do not know Tcl/TK, so I cannot write this in proper
code, only pseudo-code.

The big issue here is when you share files between different computers,
you can end up with one of them setting the "hidden" attribute for you,
since the filename starts with a . character, and on Linux, that gives
it "hidden" status automatically. When you copy the files from Linux to
Windows, your copying tool (Gareth is using PCloud with a standard
Windows mapped drive) may choose to give the file a "hidden" attribute,
since that is what is automatically had on Linux. So files can easily
gain a "hidden" flag because Therion creates lots of files with a "." at
the start of the filenames.
_______________________________________________
Therion mailing list
Therion@speleo.sk
https://mailman.speleo.sk/listinfo/therion

Reply via email to