Re: Is this yet another darn bug in 10.12.2?
Re: Is this yet another darn bug in 10.12.2?
- Subject: Re: Is this yet another darn bug in 10.12.2?
- From: 2551phil <email@hidden>
- Date: Sat, 31 Dec 2016 15:11:23 +0700
On 31 Dec 2016, at 06:32, Brian Christmas < email@hidden> wrote:
I’m using invisible files in my app to hide variables I don’t want clients to ‘see’, and to avoid cluttering up the main folder.
That’s a deplorable practice, and insecure. Users like me have a habit of deleting unknown invisible files for security reasons.
Keep all your clutter in a dedicated folder in the users Application Support folder.
If you insist on doing it, you’ll be better of using NSFileManager rather than Finder.
Shane will no doubt do it better, but something like this will work:
use AppleScript version "2.4" -- Yosemite (10.10) or later use scripting additions use framework "Foundation"
property NSString : a reference to current application's NSString property NSFileManager : a reference to current application's NSFileManager set fileManager to NSFileManager's defaultManager() set f to (fileManager's fileExistsAtPath:"/Users/path/to/.anInvisibleFile") as integer -- returns 1 if exists, 0 otherwise
set dataToWrite to "something I want to write" set pathString to NSString's stringWithString:"/Users/path/to/.anInvisibleFile" set dataString to NSString's stringWithString:dataToWrite dataString's writeToFile:pathString atomically:yes
Best
Phil |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden