I don't know of a Livecode syntax per se to do this (i.e some syntax
like: set the permissions of file tFile to read-only)
You can do this in Livecode using the shell() function (see the
dictionary) to issue applicable mac or win command lines. For eample a
Google search shows the command line to change a file's permissions on
Windows is:
attrib +r file.txt
so you could code something like (not tested):
switch platform()
case "Win32"
set the hideConsoleWindows to true -- prevents windows console
window from appears when the shell command executes
put "attrib +r " & quote & tFile & quote into tCommand -- were tFile
is the file (path and name with native \ delimiters) you want to make
read-only
put shell(tCommand) into tResult
break
case "MacOS"
-- use chmod 744 apple.txt for you to have full access and everyone
else read-only OR
-- use chmod 444 apple.txt for everyone, you included, to be read-only
put "chmod 444 " & quote & tFile & quote into tCommand -- were tFile
is the file (path and name) you want to make read-only
put shell(tCommand) into tResult
break
end switch
This code may need some tweaking but I think this is the general
approach to do what you want.
On 4/30/2023 7:35 AM, David V Glasgow via use-livecode wrote:
Hi folks,
Really simple question that I can’t see having been asked before, so here goes…
I have a stack that outputs small text files. Each includes a hash value
referencing part of itself that can be checked subsequently, so any change to
the text can be flagged.
Is there a way I can easily create read-only files (Mac & Win) to discourage
accidental user changes? No need for encryption or hiding information anywhere, I
just want to deter casual oopsies.
Thanks in anticipation...
Best Wishes,
David Glasgow
Honorary Professor, Nottingham Trent University
Sexual Offences, Crime and Misconduct Research Unit
Consultant Forensic & Clinical Psychologist
Carlton Glasgow Partnership
Director, Child & Family Training, York
LinkedIn <https://www.linkedin.com/in/davidvglasgow/>
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode