本文整理了Java中org.openide.filesystems.FileUtil.createFolder()
方法的一些代码示例,展示了FileUtil.createFolder()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.createFolder()
方法的具体详情如下:
包路径:org.openide.filesystems.FileUtil
类名称:FileUtil
方法名:createFolder
[英]Returns FileObject for a folder. If such a folder does not exist then it is created, including any necessary but nonexistent parent folders. Note that if this operation fails it may have succeeded in creating some of the necessary parent folders.
[中]返回文件夹的FileObject。如果这样的文件夹不存在,则会创建它,包括任何必要但不存在的父文件夹。请注意,如果此操作失败,它可能已成功创建一些必要的父文件夹。
代码示例来源:origin: org.netbeans.api/org-openide-filesystems
final String relativePath = getRelativePath(existingFolder, folder);
try {
retval = FileUtil.createFolder(folderFo,relativePath);
} catch (IOException ex) {
retval = FileUtil.createFolder(folderFo,relativePath);
代码示例来源:origin: org.netbeans.api/org-openide-filesystems
FileObject resolversFolder = FileUtil.getConfigFile(MIME_RESOLVERS_PATH);
if (resolversFolder == null) {
resolversFolder = FileUtil.createFolder(FileUtil.getConfigRoot(), MIME_RESOLVERS_PATH);
代码示例来源:origin: org.netbeans.api/org-openide-filesystems
foldername = name.substring(0, index);
dataname = name.substring(index + 1);
folder = createFolder(folder, foldername);
assert folder != null;
} else {
代码示例来源:origin: org.netbeans.api/org-openide-filesystems
createFolder(fo, name);
代码示例来源:origin: org.netbeans.api/org-openide-filesystems
/** Converts the file to be writable.
* The file has to be locked!
*
* @return file object (new leader) that is writable
* @exception IOException if the object cannot be writable
*/
private FileObject writable(boolean copyContents) throws IOException {
MultiFileSystem fs = getMultiFileSystem();
FileSystem single = fs.createWritableOn(getPath());
if (single != leader.getFileSystem()) {
// if writing to a file that is not on writable fs =>
// copy it
if (leader.isFolder()) {
leader = FileUtil.createFolder(root(single), getPath());
} else {
FileObject folder = FileUtil.createFolder(root(single), getParent().getPath());
if (copyContents) {
leader = leader.copy(folder, leader.getName(), leader.getExt());
} else {
leader = folder.createData(leader.getNameExt());
}
}
MfLock l = ((lock == null) ? null : lock.get());
if (l != null) {
// update the lock
l.addLock(leader);
}
}
return leader;
}
代码示例来源:origin: org.netbeans.api/org-openide-filesystems
FileUtil.createFolder(root(simple), fullName);
代码示例来源:origin: org.netbeans.api/org-openide-filesystems
FileObject folder = FileUtil.createFolder(root(single), getParent().getPath());
leader = leader.copy(folder, name, ext);
copyAttrs(this, leader);
} else {
FileObject fo = FileUtil.createFolder(root(single), newFullName);
copyContent(this, fo);
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-project
private static boolean mkLocalDirs(File folder) {
try {
FileUtil.createFolder(folder);
} catch (IOException exc) {
LOGGER.log(Level.INFO, null, exc);
return false;
}
return true;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-sun-appsrv
private void ensureFolderExists(File folder) throws IOException {
if(!folder.exists()) {
FileUtil.createFolder(folder);
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-sun-appsrv
public static Resources getServerResourcesGraph(File targetFolder){
FileObject location = FileUtil.toFileObject(targetFolder.getParentFile());
try{
location = FileUtil.createFolder(targetFolder);
} catch (Exception ex) {
LOG.log(Level.SEVERE, "getServerResourcesGraph failed", ex);
}
return getServerResourcesGraph(location,"");
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-glassfish-javaee
private static void writeResourceFile(final File sunResourcesXml, final String content) throws IOException {
FileObject parentFolder = FileUtil.createFolder(sunResourcesXml.getParentFile());
FileSystem fs = parentFolder.getFileSystem();
writeResourceFile(fs, sunResourcesXml, content);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-core
private static DataFolder findSessionFolder(String name) {
try {
FileObject fo = FileUtil.getConfigFile(name);
if (fo == null) {
// resource not found, try to create new folder
fo = FileUtil.createFolder(FileUtil.getConfigRoot(), name);
}
return DataFolder.findFolder(fo);
} catch (IOException ex) {
throw (IllegalStateException) new IllegalStateException("Folder not found and cannot be created: " + name).initCause(ex); // NOI18N
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-jsf
private FileObject handleCssFolderCreation(JSFVersion jsfVersion, FileObject rootDir) throws IOException {
String folderName = (jsfVersion == null || jsfVersion.isAtLeast(JSFVersion.JSF_2_0)) ? CSS_FOLDER2 : CSS_FOLDER;
FileObject cssFolder = rootDir.getFileObject(folderName);
if (cssFolder == null) {
cssFolder = FileUtil.createFolder(rootDir, folderName);
}
return cssFolder;
}
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-project-ant-ui
public void copyFilesIfNecessary() throws IOException {
if (!isCopy()) {
return;
}
File f = FileUtil.normalizeFile(new File(copyTo.getText()));
FileUtil.createFolder(f);
FileObject fo = FileUtil.toFileObject(f);
List<File> selectedFiles = Arrays.asList(getSelectedFiles());
copyFiles(selectedFiles, fo);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-testng-maven
private FileObject copy(FileObject source) throws IOException {
FileObject fo = p.getProjectDirectory();
//target/nb-private/tesng-suite.xml
FileObject folder = FileUtil.createFolder(fo, "target/nb-private"); //NOI18N
FileObject cfg = folder.getFileObject("testng-suite", "xml"); //NOI18N
if (cfg != null) {
cfg.delete();
}
return FileUtil.copyFile(source, folder, "testng-suite"); //NOI18N
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-project
@Override
public FileObject createLocation() throws IOException {
// the folder should have been created when the project was generated
FileObject location = project.getWebModule().getPersistenceXmlDir();
if (location == null) {
// But possibly the folder got deleted by the user
// or missing for whatever reason (see issue 134870)
location = FileUtil.createFolder(project.getWebModule().getPersistenceXmlDirAsFile());
}
return location;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-clientproject
public FileObject getWsdlFolder(boolean create) throws IOException {
String metaInfStr = helper.getStandardPropertyEvaluator().getProperty(AppClientProjectProperties.META_INF);
String wsdlFolderStr = metaInfStr + '/' + WSDL_FOLDER; // NOI18N
FileObject wsdlFolder = project.getProjectDirectory().getFileObject(wsdlFolderStr);
if (wsdlFolder == null && create) {
wsdlFolder = FileUtil.createFolder(project.getProjectDirectory(), wsdlFolderStr);
}
return wsdlFolder;
}
代码示例来源:origin: org.codehaus.mevenide/nb-project
public void applyChanges() {
if (setts == null) {
setts = MavenSettingsSingleton.getInstance().createUserSettingsModel();
}
getPanel().applyValues(setts);
try {
File userDir = MavenSettingsSingleton.getInstance().getM2UserDir();
WriterUtils.writeSettingsModel(FileUtil.createFolder(userDir), setts);
} catch (IOException ex) {
ex.printStackTrace();
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide-loaders
/** Creates new folder and copies attributes.
* @param f the folder to create this entry in
* @param suffix suffix appended to the new name to use
* @return the copied <code>FileObject</code> or <code>null</code> if it cannot be copied
* @exception IOException when the operation fails
*/
public FileObject copy (FileObject f, String suffix) throws IOException {
String add = suffix + ((getFile ().getExt ().length () > 0) ? "." + getFile ().getExt () : "");
FileObject fo = FileUtil.createFolder (f, getFile ().getName () + add);
FileUtil.copyAttributes (getFile (), fo);
return fo;
}
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-java-source-base
public static File getIndex(URL url) throws IOException {
url = CachingArchiveProvider.getDefault().mapCtSymToJar(url);
FileObject indexBaseFolder = CacheFolder.getDataFolder(url);
String path = SPIAccessor.getInstance().getIndexerPath(NAME, VERSION);
FileObject indexFolder = FileUtil.createFolder(indexBaseFolder, path);
return FileUtil.toFile(indexFolder);
}
内容来源于网络,如有侵权,请联系作者删除!