Deleting files on Vista

Shari shari at gypsyware.com
Fri Jun 29 13:00:29 EDT 2007


At 10:53 AM -0500 6/29/07, Ken Ray wrote:
>First of all, where are you creating the files? Is it in the Program
>Files folder? If so, it will be virtualized to:
>
>    C:\Users\<USERNAME>\AppData\Local\VirtualStore\Program
Files\<APPNAME>\

Not there, nope.  I was under the impression that this folder is no 
longer writeable.  The main app goes there, but none of the files 
that require writeability.

My code actually runs thru a series of supposedly writeable folders 
to see if they exist, and the first hit it gets that's where the 
Prefs go.  This to ensure that some OS change where a folder no 
longer exists at least has a hope of finding a useable folder.

So using your example above as a template, I should be able to create 
a series of VirtualStore paths to check?  So if the path to the real 
prefs file was:

C:/Documents and Settings/All Users/Application 
Data/myCreatedPrefsFolder/myPrefsFiles

The virtual path (with no returns) would be:

  C:/Users/<USERNAME>/AppData/Local/VirtualStore/
Documents and Settings/All Users/Application Data/<APPNAME>/
myCreatedPrefsFolder/myPrefsFiles

Would it also create the folder I created to put the prefs in?  Or 
would it just create the prefs files?

The code I use to find a preferences file path is as follows:


on prefsPath
   global gPrefsFolder,sFolder
   if platform() is "MacOS" then
     put empty into gPrefsFolder
     put "Preferences,Docs,Desktop" into tit
     repeat for each item x in tit
       put specialFolderPath(x) into sFolder
       put specialFolderPath(x) & "/myFolderName" into gPrefsFolder
       if gPrefsFolder is not empty then
         exit repeat
       end if
     end repeat
   else if platform() is "Win32" then
     put empty into gPrefsFolder
     put "35,46,28,Documents,Desktop" into tit
     repeat for each item x in tit
       put specialFolderPath(x) into sFolder
       put specialFolderPath(x) & "/myFolderName" into gPrefsFolder
       if gPrefsFolder is not empty then
         exit repeat
       end if
     end repeat
   end if
   if there is not a folder gPrefsFolder then
     create folder gPrefsFolder
   end if
end prefsPath



>
>First of all, where are you creating the files? Is it in the Program
>Files folder? If so, it will be virtualized to:
>
>    C:\Users\<USERNAME>\AppData\Local\VirtualStore\Program
>Files\<APPNAME>\
>
>So this:
>
>>      put specialFolderPath(x) & "/VirtualStore" into dPath
>>  put "/someFile" after dPath
>>        if there is a file dPath then
>>          delete file dPath
>>        end if
>
>probably won't work... (This is covered in the Vista "Gotchas" tip at
>http://www.sonsothunder.com/devres/revolution/tips/env007.htm).
>
>>  He does have Vista.  So.... does Vista allow create and not delete?
>>
>>  And is it possible to delete from VirtualStore?
>
>Yes... in fact I've been able to delete from the VirtualStore even with
>UAC turned on. So I just think it's a path issue. Best would be to
>check to see if the file exists before you try to delete it, IMHO.
>
>Ken Ray
>Sons of Thunder Software, Inc.
>Email: kray at sonsothunder.com
>Web Site: http://www.sonsothunder.com/


-- 
Windows and Macintosh shareware games
BIackjack Gold
http://www.gypsyware.com



More information about the use-livecode mailing list