• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Is this yet another darn bug in 10.12.2?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Is this yet another darn bug in 10.12.2? (From: Brian Christmas <email@hidden>)

  • Prev by Date: Re: Is this yet another darn bug in 10.12.2?
  • Next by Date: Re: Is this yet another darn bug in 10.12.2?
  • Previous by thread: Re: Is this yet another darn bug in 10.12.2?
  • Index(es):
    • Date
    • Thread