Imported GNU Classpath 0.19 + gcj-import-20051115.
* sources.am: Regenerated. * Makefile.in: Likewise. * scripts/makemake.tcl: Use glob -nocomplain. From-SVN: r107049
This commit is contained in:
parent
02e549bfaa
commit
8f523f3a10
1241 changed files with 97711 additions and 25284 deletions
|
@ -100,6 +100,17 @@ public class File implements Serializable, Comparable
|
|||
* may be an absolute or relative path name.
|
||||
*/
|
||||
private String path;
|
||||
|
||||
|
||||
/**
|
||||
* The time (millisecond), when the last temporary file was created.
|
||||
*/
|
||||
private static long last_tmp;
|
||||
|
||||
/**
|
||||
* The number of files, created during the current millisecond.
|
||||
*/
|
||||
private static int n_created;
|
||||
|
||||
/**
|
||||
* This method tests whether or not the current thread is allowed to
|
||||
|
@ -446,6 +457,8 @@ public class File implements Serializable, Comparable
|
|||
else
|
||||
return drvDir;
|
||||
}
|
||||
else if (path.equals(""))
|
||||
return System.getProperty ("user.dir");
|
||||
else
|
||||
return System.getProperty ("user.dir") + separatorChar + path;
|
||||
}
|
||||
|
@ -532,6 +545,9 @@ public class File implements Serializable, Comparable
|
|||
{
|
||||
String prefix = null;
|
||||
int nameSeqIndex = 0;
|
||||
|
||||
if (path.equals(""))
|
||||
return null;
|
||||
|
||||
// The "prefix", if present, is the leading "/" on UNIX and
|
||||
// either the drive specifier (e.g. "C:") or the leading "\\"
|
||||
|
@ -943,8 +959,8 @@ public class File implements Serializable, Comparable
|
|||
public URI toURI()
|
||||
{
|
||||
String abspath = getAbsolutePath();
|
||||
|
||||
if (isDirectory())
|
||||
|
||||
if (isDirectory() || path.equals(""))
|
||||
abspath = abspath + separatorChar;
|
||||
|
||||
if (separatorChar == '\\')
|
||||
|
@ -1059,7 +1075,7 @@ public class File implements Serializable, Comparable
|
|||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
public static File createTempFile(String prefix, String suffix,
|
||||
public static synchronized File createTempFile(String prefix, String suffix,
|
||||
File directory)
|
||||
throws IOException
|
||||
{
|
||||
|
@ -1091,10 +1107,23 @@ public class File implements Serializable, Comparable
|
|||
// Now identify a file name and make sure it doesn't exist.
|
||||
File file;
|
||||
if (!VMFile.IS_DOS_8_3)
|
||||
{
|
||||
{
|
||||
do
|
||||
{
|
||||
String filename = prefix + System.currentTimeMillis() + suffix;
|
||||
long now = System.currentTimeMillis();
|
||||
if (now > last_tmp)
|
||||
{
|
||||
// The last temporary file was created more than 1 ms ago.
|
||||
last_tmp = now;
|
||||
n_created = 0;
|
||||
}
|
||||
else
|
||||
n_created++;
|
||||
|
||||
String name = Long.toHexString(now);
|
||||
if (n_created > 0)
|
||||
name += '_'+Integer.toHexString(n_created);
|
||||
String filename = prefix + name + suffix;
|
||||
file = new File(directory, filename);
|
||||
}
|
||||
while (VMFile.exists(file.path));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue