Ticket #171 (closed enhancement: fixed)

Opened 12 years ago

Last modified 11 years ago

All temporary files must be stored in temporary directory

Reported by: kmaclean Owned by: kmaclean
Priority: minor Milestone: SpeechSubmission 0.1
Component: SpeechSubmission Version: Website 0.2
Keywords: Cc:

Description

Currently, some files are being stored in default user directory

Change History

comment:1 Changed 12 years ago by kmaclean

  • Type changed from defect to enhancement

comment:2 Changed 12 years ago by kmaclean

  • Priority changed from major to minor

comment:3 Changed 12 years ago by kmaclean

see Real's how-to: Create a temporary file

The location of the directory used to hold temporary files is defined by the property java.io.tmpdir. The default value can be changed with the command line used to launch the JVM :

java -Djava.io.tmpdir=C:\mydir  myClass

or , on Windows, you can set the environment variable TMP to a different value.

On some plateform, the temporary directory returned by java.io.tmpdir do not include a trailing slash. That is,

Win NT  --> C:\TEMP\
Win XP  --> C:\TEMP
Solaris --> /var/tmp/
Linux   --> /var/tmp

It's not a bad idea to check if there is a trailing slash or not.

String tempdir = System.getProperty("java.io.tmpdir");

if ( !(tempdir.endsWith("/") || tempdir.endsWith("\\")) )
   tempdir = tempdir + System.getProperty("file.separator");

comment:4 Changed 12 years ago by kmaclean

See Sun RFE #4735419

File f=File.createTempFile(...);
f.delete();
f.mkdir();

comment:5 Changed 12 years ago by kmaclean

  • Status changed from new to closed
  • Resolution set to fixed

comment:6 Changed 11 years ago by root

  • Milestone SpeechSubmission 0.1 deleted

Milestone SpeechSubmission 0.1 deleted

comment:7 Changed 11 years ago by kmaclean

  • Milestone set to SpeechSubmission 0.1
Note: See TracTickets for help on using tickets.