Java Code Examples for com.intellij.openapi.vcs.FilePath#getIOFile()
The following examples show how to use
com.intellij.openapi.vcs.FilePath#getIOFile() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VersionControlPath.java From azure-devops-intellij with MIT License | 5 votes |
public static FilePath getCombinedLocalPath(final FilePath localPathBase, final String serverPathBase, final String serverPath, final boolean isDirectory) { String serverPathBaseString = FileUtil.toSystemDependentName(serverPathBase); String serverPathString = FileUtil.toSystemDependentName(serverPath); File localFile = new File(localPathBase.getIOFile(), serverPathString.substring(serverPathBaseString.length())); return VcsUtil.getFilePath(localFile, isDirectory); }
Example 2
Source File: TFSDiffProvider.java From azure-devops-intellij with MIT License | 5 votes |
public ItemLatestState getLastRevision(final FilePath localPath) { try { // need to make a file because the FilePath object path is in system-independent format final File localFile = localPath.getIOFile(); final VcsRevisionNumber revisionNumber = getRevisionNumber(localFile.getPath(), localFile.getName()); if (revisionNumber != VcsRevisionNumber.NULL) { return new ItemLatestState(revisionNumber, true, false); } } catch (final Exception e) { logger.warn("Unable to getLastRevision", e); AbstractVcsHelper.getInstance(project).showError( new VcsException(LocalizationServiceImpl.getInstance().getExceptionMessage(e), e), TFSVcs.TFVC_NAME); } return new ItemLatestState(VcsRevisionNumber.NULL, false, false); }
Example 3
Source File: RemoteFileUtil.java From p4ic4idea with Apache License 2.0 | 5 votes |
private static boolean isRoot(FilePath file, File[] roots) { if (file == null) { return true; } File f = file.getIOFile(); for (File root : roots) { if (FileUtil.filesEqual(root, f)) { return true; } } return false; }
Example 4
Source File: FetchFilesAction.java From p4ic4idea with Apache License 2.0 | 5 votes |
/** * Intended to find a directory to use as the "working directory" for the path. The returned path * is just a parent directory to one of the files in the sync request. The primary idea is finding * a base directory for the server to use as the root of the client workspace; with an AltRoot definition, * the server needs this, or it will generate error messages if the given files are not under the client * root used by the current working directory. * * @return a directory for the files. */ @NotNull public File getCommonDir() { for (FilePath file : syncPaths) { FilePath parent = file.getParentPath(); if (parent != null) { return parent.getIOFile(); } } throw new RuntimeException("Unable to find a parent directory for " + syncPaths); }
Example 5
Source File: ShelveFilesAction.java From p4ic4idea with Apache License 2.0 | 5 votes |
@NotNull public File getCommonDir() { for (FilePath file : files) { FilePath parent = file.getParentPath(); if (parent != null) { return parent.getIOFile(); } } throw new RuntimeException("Unable to find a parent directory for " + files); }
Example 6
Source File: MoveFilesToChangelistAction.java From p4ic4idea with Apache License 2.0 | 5 votes |
/** * Intended to find a directory to use as the "working directory" for the path. The returned path * is just a parent directory to one of the files in the move request. The primary idea is finding * a base directory for the server to use as the root of the client workspace; with an AltRoot definition, * the server needs this, or it will generate error messages if the given files are not under the client * root used by the current working directory. * * @return a directory for the files. */ @NotNull public File getCommonDir() { for (FilePath file : files) { FilePath parent = file.getParentPath(); if (parent != null) { return parent.getIOFile(); } } throw new RuntimeException("Unable to find a parent directory for " + files); }
Example 7
Source File: SubmitChangelist.java From p4ic4idea with Apache License 2.0 | 5 votes |
public File getExecDir(P4CommandRunner.ClientAction<?> baseType) { SubmitChangelistAction action = (SubmitChangelistAction) baseType; // Get most common root path. FilePath root = FileTreeUtil.getCommonRoot(action.getFiles()); if (root == null) { return null; } return root.getIOFile(); }
Example 8
Source File: MoveFileTest.java From p4ic4idea with Apache License 2.0 | 5 votes |
private static String getContents(FilePath file) throws IOException { try (FileReader inp = new FileReader(file.getIOFile())) { StringBuilder sb = new StringBuilder(); char[] b = new char[4096]; int len; while ((len = inp.read(b, 0, 4096)) > 0) { sb.append(b, 0, len); } return sb.toString(); } }
Example 9
Source File: ChangesUtil.java From consulo with Apache License 2.0 | 5 votes |
@javax.annotation.Nullable private static File getCommonBeforeAfterAncestor(@Nonnull Change change) { FilePath before = getBeforePath(change); FilePath after = getAfterPath(change); return before == null ? ObjectUtils.assertNotNull(after).getIOFile() : after == null ? before.getIOFile() : FileUtil.findAncestor(before.getIOFile(), after.getIOFile()); }
Example 10
Source File: ChangesBrowserBase.java From consulo with Apache License 2.0 | 5 votes |
private File[] getSelectedIoFiles() { final List<Change> changes = getSelectedChanges(); final List<File> files = new ArrayList<>(); for (Change change : changes) { final ContentRevision afterRevision = change.getAfterRevision(); if (afterRevision != null) { final FilePath file = afterRevision.getFile(); final File ioFile = file.getIOFile(); files.add(ioFile); } } return files.toArray(new File[files.size()]); }
Example 11
Source File: MoveFileTest.java From p4ic4idea with Apache License 2.0 | 4 votes |
private static void setContents(FilePath file, String contents) throws IOException { try (FileWriter out = new FileWriter(file.getIOFile())) { out.write(contents); } }
Example 12
Source File: ContentRevisionCache.java From consulo with Apache License 2.0 | 4 votes |
private static void checkLocalFileSize(FilePath path) throws VcsException { File ioFile = path.getIOFile(); if (ioFile.exists()) { checkContentsSize(ioFile.getPath(), ioFile.length()); } }
Example 13
Source File: PathMerger.java From consulo with Apache License 2.0 | 4 votes |
public FilePathPathMerger(final FilePath base) { myIoDelegate = new IoFilePathMerger(base.getIOFile()); }