Refine search
public static File createTempDir(String suffix) { try { Path path = Files.createTempDirectory("jadx-tmp-" + System.nanoTime() + "-" + suffix); path.toFile().deleteOnExit(); return path.toFile(); } catch (IOException e) { throw new JadxRuntimeException("Failed to create temp directory with suffix: " + suffix); } }
/** * Create a temporary directory for GenIC output. * * @return the temp directory. * @throws BuildException if a temp directory cannot be created. */ private File createTempDir() throws IOException { return Files.createTempDirectory("genic").toFile(); }
public File createTempDir() { try { return Files.createTempDirectory(tempDir.toPath(), "plugins").toFile(); } catch (IOException e) { throw new IllegalStateException("Fail to create temp directory in " + tempDir, e); } }
public String perform() { try { Path tmpDir; if (parentDir != null) { Path dir = vertx.resolveFile(parentDir).toPath(); if (attrs != null) { tmpDir = Files.createTempDirectory(dir, prefix, attrs); } else { tmpDir = Files.createTempDirectory(dir, prefix); } } else { if (attrs != null) { tmpDir = Files.createTempDirectory(prefix, attrs); } else { tmpDir = Files.createTempDirectory(prefix); } } return tmpDir.toFile().getAbsolutePath(); } catch (IOException e) { throw new FileSystemException(e); } } };
@VisibleForTesting public File v3ConversionTempDirectory(File v2SegmentDirectory) throws IOException { File v3TempDirectory = Files.createTempDirectory(v2SegmentDirectory.toPath(), v2SegmentDirectory.getName() + V3_TEMP_DIR_SUFFIX) .toFile(); return v3TempDirectory; }
private File createTempDirectory() { try { if (SystemUtils.IS_OS_MAC) { return Files.createTempDirectory(Paths.get(OS_MAC_TMP_DIR), TESTCONTAINERS_TMP_DIR_PREFIX).toFile(); } return Files.createTempDirectory(TESTCONTAINERS_TMP_DIR_PREFIX).toFile(); } catch (IOException e) { return new File(TESTCONTAINERS_TMP_DIR_PREFIX + Base58.randomString(5)); } }
Path getApplicationLayersCacheDirectory() throws CacheDirectoryCreationException { if (applicationLayersCacheDirectory == null) { // Uses a temporary directory if application layers cache directory is not set. try { Path temporaryDirectory = Files.createTempDirectory(null); temporaryDirectory.toFile().deleteOnExit(); this.applicationLayersCacheDirectory = temporaryDirectory; } catch (IOException ex) { throw new CacheDirectoryCreationException(ex); } } return applicationLayersCacheDirectory; }
private File createDirectoryForNewUser(String userId) throws IOException { try { Path tempDirectory = Files.createTempDirectory(Util.fileToPath(usersDirectory), generatePrefix(userId)); return tempDirectory.toFile(); } catch (IOException e) { LOGGER.log(Level.SEVERE, "Error creating directory for user: " + userId, e); throw e; } }
public static String createTempDir(String name) { Path tmpDir; try { tmpDir = Files.createTempDirectory(name); } catch (IOException e) { throw new RuntimeException("Couldn't create temporary directory!", e); } String tmpPath = tmpDir.toAbsolutePath().toString(); tmpDir.toFile().deleteOnExit(); return tmpPath; }
public void startFile(String memberId) throws IOException { if (currentFile != null || currentOutputStream != null) { throw new IllegalStateException("Cannot open more than one file at once"); } currentFile = Files.createTempDirectory(memberId).resolve(memberId + ".zip"); currentOutputStream = new BufferedOutputStream(new FileOutputStream(currentFile.toFile())); isEmpty = true; }
public static Path createSecuredTempDirectory(String prefix) throws IOException { Path tempDir = Files.createTempDirectory(prefix); tempDir.toFile().setExecutable(true, true); tempDir.toFile().setWritable(true, true); tempDir.toFile().setReadable(true, true); return tempDir; } }
private static File disassemble(File file) throws IOException { Path tempDir = Files.createTempDirectory(TEMP_DIR_NAME); String[] args = new String[]{"disassemble", "--use-locals", "--sequential-labels", "--code-offsets", file.getAbsolutePath(), "--output", tempDir.toString(),}; org.jf.baksmali.Main.main(args); return tempDir.toFile(); }
/** * Creates a new temporary directory. */ public static File createTempDir() throws IOException { // The previously used approach of creating a temporary file, deleting // it, and making a new directory having the same name in its place is // potentially problematic: // https://stackoverflow.com/questions/617414/how-to-create-a-temporary-directory-folder-in-java // We can use the Java 7 Files.createTempDirectory() API, but note that // by default, the permissions of the created directory are 0700&(~umask) // whereas the old approach created a temporary directory with permissions // 0777&(~umask). // To avoid permissions problems like https://issues.jenkins-ci.org/browse/JENKINS-48407 // we can pass POSIX file permissions as an attribute (see, for example, // https://github.com/jenkinsci/jenkins/pull/3161 ) final Path tempPath; final String tempDirNamePrefix = "jenkins"; if (FileSystems.getDefault().supportedFileAttributeViews().contains("posix")) { tempPath = Files.createTempDirectory(tempDirNamePrefix, PosixFilePermissions.asFileAttribute(EnumSet.allOf(PosixFilePermission.class))); } else { tempPath = Files.createTempDirectory(tempDirNamePrefix); } return tempPath.toFile(); }
@Override public String invoke(File dir, VirtualChannel channel) throws IOException { Path tempPath; final boolean isPosix = FileSystems.getDefault().supportedFileAttributeViews().contains("posix"); if (isPosix) { tempPath = Files.createTempDirectory(Util.fileToPath(dir), name, PosixFilePermissions.asFileAttribute(EnumSet.allOf(PosixFilePermission.class))); } else { tempPath = Files.createTempDirectory(Util.fileToPath(dir), name, new FileAttribute<?>[] {}); } if (tempPath.toFile() == null) { throw new IOException("Failed to obtain file from path " + dir + " on " + remote); } return tempPath.toFile().getName(); } }
@SuppressWarnings("SameParameterValue") private static File createTempDir(String prefix) { try { return createTempDirectory(prefix).toFile(); } catch (IOException e) { throw new UncheckedIOException(e); } } }
public static File createTempDir() throws IOException { return Files.createTempDirectory( "neo4j-test" ).toFile(); }
private File createTemporaryDirectory(String name) throws IOException { File f = Files.createTempDirectory(name).toFile(); tempDirs.add(f); return f; } }
private static File createTemporaryDirectory(String name) throws IOException { File f = Files.createTempDirectory(name).toFile(); TEMP_DIRS.add(f); return f; } }
static File createTempDir() throws Exception { return Files.createTempDirectory( WalletUtilsTest.class.getSimpleName() + "-testkeys").toFile(); }
@Override public Path createTempFolder() { Path path; try { path = Files.createTempDirectory(EvaluatorBaseTest.TEMP_DIR_NAME); path.toFile().deleteOnExit(); } catch (Exception e) { throw new RuntimeException(e); } return path; } };