Re: temp directory question




"kimiraikkonen" <kimiraikkonen85@xxxxxxxxx> wrote in message news:26930928-77a6-4de6-b926-51b59a27753d@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Apr 7, 8:42 am, "RobinS" <rob...@xxxxxxxxxxxxxxxx> wrote:
This will cause you a problem in Windows Vista if your application is
installed in ProgramFiles. A better choice would be to put the file in the
local app data, which is under the user's profile --
Environment.SpecialFolder.LocalApplicationData.

RobinS.
GoldMail.com

"kimiraikkonen" <kimiraikkone...@xxxxxxxxx> wrote in message

news:11ccddb0-edb1-4843-8cfc-c62f6b68abd2@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Apr 6, 8:13 am, "Aussie Rules" <aus...@xxxxxxxxxx> wrote:



> Hi,

> In my application I need to write an XML file to disk, but am concerned
> that
> permission might be a problem.

> The file only needs to be written out and used for another reason and > can
> then be deleted.

> I was thinking about using the windows/system temp directory as the
> location, as I guess that a directory where my application shouldn't > have
> an
> issue writting to.

> Is this the best location for this file to go? and how do I determine > what
> the temp directory is ?

> Thanks

If you have any difficulty about writing to a specific folder such as
temp (plus you may able to write), create your own temp folder in your
application folder then delete folder / file after operation has
finished.

For example when you need a folder temporarily, create a new one
using:
System.IO.Directory.CreateDirectory("c:\your_app\your_folder")

Then you can delete folder fairly after the directory is not needed
anylonger using:
(usually when formclosing event is fired)
System.IO.Directory.Delete("c:\your_app\your_folder")

Therefore you have a folder that's created and deleted temporarily,
just my opinion.

Regards,

Onur Güzel

--I'm not familiar with Vista at the moment so i don't know what you
--meant about what it causes, but you must be able to create and delete
--your own folders with no problem in XP and olders in program files.
--Maybe program files is protected in Vista. Thanks for the info.

Yes, Program files is protected in Vista. No more keeping-the-database-with-the-program stuff going on. I noticed the even Adobe Photoshop Elements creates a folder under MyDocuments for caching and temp stuff. There are specific locations that MSFT recommends for keeping files for the user to update when using Windows Vista.

--But with same logic you can dynamically create / delete a folder in a
-writable location such as you mentioned.

Exactly. The best idea in the thread was about getting a temp filename. I was just responding to yours so people would know.

RobinS.
GoldMail.com

.



Relevant Pages

  • Re: Temporary files accumulating
    ... If you want help with Error Report this extract from my post 2 days ago may ... At each bootup and at the same time as the "permanent" temp ... though I don't know how to fix it) I took a look at the temp folder in my ... 20 or more of these accumulating in the Temp folder. ...
    (microsoft.public.windowsxp.general)
  • Re: why is my word docx being deleted?
    ... You mention in another reply that you have Adobe open: is this just the viewer or the Acrobat Writer? ... check with Adobe that you have the latest updates for the version you are using and that Adobe state it has been made Office 2007 compatible. ... they were NOT in the temp folder. ... In your Temp folder or in the same folder as the original ...
    (microsoft.public.word.application.errors)
  • Re: Temporary files accumulating
    ... At each bootup and at the same time as the "permanent" temp ... though I don't know how to fix it) I took a look at the temp folder in my ... I would like to solve the Help and Support problem though, ... 20 or more of these accumulating in the Temp folder. ...
    (microsoft.public.windowsxp.general)
  • Re: %temp% Mystery
    ... System account. ... In Windows 2000, when an application or service used the LoadUserProfile API ... The other temp in Windows still behaves as it always has. ... [[Programs sometimes store temporary information in a Temp folder. ...
    (microsoft.public.windowsxp.general)
  • Re: Excel druckt mal und mal nicht
    ... Und es handelt sich tatsächlich *NICHT* um die Anzahl der Dateien im TEMP ... folder, sondern um den Platz, den alle Dateien dort ... wenn zuviel im Tempfolder "rumliegt". ...
    (microsoft.public.de.excel)