private static AbstractFile createTemporaryFolder() { AbstractFile tempFolder; try { tempFolder = FileFactory.getTemporaryFile("mucomander-self-update", true); tempFolder.mkdir(); } catch(IOException e) { tempFolder = FileFactory.getTemporaryFolder(); } return tempFolder; }
/** * Calls {@link #testResolveDestination(AbstractFile)} with the system's temporary folder. * * @throws IOException should not happen */ @Test public void testResolveLocalDestination() throws IOException { testResolveDestination(FileFactory.getTemporaryFolder()); }
/** * Creates a new <code>TempExecJob</code> that operates on a single file. * * @param progressDialog the ProgressDialog that monitors this job * @param mainFrame the MainFrame this job is attached to * @param fileToCopy the file to copy to a temporary location */ public TempCopyJob(ProgressDialog progressDialog, MainFrame mainFrame, AbstractFile fileToCopy) { super(progressDialog, mainFrame, new FileSet(fileToCopy.getParent(), fileToCopy), FileFactory.getTemporaryFolder(), getTemporaryFileName(fileToCopy), TransferMode.COPY, FileCollisionDialog.OVERWRITE_ACTION); }
@BeforeClass protected void setUp() throws Exception { TestFile parent = new TestFile(FileFactory.getTemporaryFolder() + "parent", null); abcdef = new TestFile(FileFactory.getTemporaryFolder() + "abcdef", parent); abcdef_ghi = new TestFile(FileFactory.getTemporaryFolder() + "abcdef.ghi", parent); abcdef_ghi_jkl = new TestFile(FileFactory.getTemporaryFolder() + "abcdef.ghi.jkl", parent); _abcdef = new TestFile(FileFactory.getTemporaryFolder() + ".abcdef", parent); }
@BeforeMethod protected void setUp() throws Exception { A = new TestFile(FileFactory.getTemporaryFolder() + "A", false, 500, 1, null); B = new TestFile(FileFactory.getTemporaryFolder() + "B.e9.e1", true, 0, 2, null); C = new TestFile(FileFactory.getTemporaryFolder() + "C.e3", false, 200, 3, null); D = new TestFile(FileFactory.getTemporaryFolder() + "D.e2", true, 0, 4, null); files = new AbstractFile[4]; files[0] = C; files[1] = D; files[2] = A; files[3] = B; }
protected static AbstractFile getTemporaryFolder(FileSet files) { AbstractFile tempFolder; try { tempFolder = FileFactory.getTemporaryFile(files.getBaseFolder().getName(), true); tempFolder.mkdir(); } catch(IOException e) { tempFolder = FileFactory.getTemporaryFolder(); } return tempFolder; }
/** * Tests {@link com.mucommander.commons.file.FileFactory#getTemporaryFolder()}. * * @throws IOException should not happen */ @Test public void testTemporaryFolder() throws IOException { // Assert that the returned file is a folder that exists AbstractFile temporaryFolder = FileFactory.getTemporaryFolder(); assert temporaryFolder != null; assert temporaryFolder.isDirectory(); assert temporaryFolder.exists(); // Assert that the temporary folder is the parent folder of temporary files AbstractFile temporaryFile = FileFactory.getTemporaryFile(false); assert temporaryFile.getParent().equals(temporaryFolder); }