net.sf.latexdraw.util
Class LFileUtils

java.lang.Object
  extended by net.sf.latexdraw.util.LFileUtils

public final class LFileUtils
extends java.lang.Object

Defines some workarounds to deal with the problem of the renameto function. The renameto function cannot rename a file from one filesystem to one other.

This file is part of LaTeXDraw
Copyright (c) 2005-2012 Arnaud BLOUIN

LaTeXDraw is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

LaTeXDraw is distributed without any warranty; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

09/22/09

Version:
3.0
Author:
Arnaud BLOUIN

Field Summary
static LFileUtils INSTANCE
          The singleton.
 
Constructor Summary
private LFileUtils()
           
 
Method Summary
 boolean copy(java.io.File fromFile, java.io.File toFile)
          Copies a file.
 java.io.File createTempDir()
          Creates a temporary directory that will be used to contains temporary latex files.
 boolean move(java.io.File fromFile, java.io.File toFile)
          Moves a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final LFileUtils INSTANCE
The singleton.

Constructor Detail

LFileUtils

private LFileUtils()
Method Detail

createTempDir

public java.io.File createTempDir()
Creates a temporary directory that will be used to contains temporary latex files. The created folder will have restricted access: only the user can access the folder.

Returns:
The created folder or null.

copy

public boolean copy(java.io.File fromFile,
                    java.io.File toFile)
Copies a file. The renameTo method does not allow action across NFS mounted filesystems this method is the workaround

Parameters:
fromFile - The existing File
toFile - The new File
Returns:
true if and only if the renaming succeeded; false otherwise

move

public boolean move(java.io.File fromFile,
                    java.io.File toFile)
Moves a file. The renameTo method does not allow action across NFS mounted filesystems this method is the workaround

Parameters:
fromFile - The existing File
toFile - The new File
Returns:
true if and only if the renaming succeeded; false otherwise