本文整理汇总了Java中net.fusejna.ErrorCodes.EEXIST属性的典型用法代码示例。如果您正苦于以下问题:Java ErrorCodes.EEXIST属性的具体用法?Java ErrorCodes.EEXIST怎么用?Java ErrorCodes.EEXIST使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.fusejna.ErrorCodes
的用法示例。
在下文中一共展示了ErrorCodes.EEXIST属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
@Override
public int create(String path, ModeWrapper mode, FileInfoWrapper info) {
Node node = root.find(path);
if (node != null) {
return -ErrorCodes.EEXIST();
}
int pos = path.lastIndexOf('/');
if (pos < 0) {
return -ErrorCodes.ENOENT();
}
String name = path.substring(pos + 1);
if (name.length() < 1) {
return -ErrorCodes.ENOENT();
}
path = path.substring(0, pos);
if (path.length() < 1) {
path = "/";
}
node = root.find(path);
if (node == null || !node.isDir()) {
return -ErrorCodes.ENOENT();
}
return node.create(name, mode, info);
}
示例2: link
@Override
public int link(String path, String target) {
Node targetNode = root.find(target);
if (targetNode == null) {
return -ErrorCodes.ENOENT();
}
Node node = root.find(path);
if (node != null) {
return -ErrorCodes.EEXIST();
}
int pos = path.lastIndexOf('/');
if (pos < 0) {
return -ErrorCodes.ENOENT();
}
String name = path.substring(pos + 1);
if (name.length() < 1) {
return -ErrorCodes.ENOENT();
}
path = path.substring(0, pos);
if (path.length() < 1) {
path = "/";
}
node = root.find(path);
if (node == null || !node.isDir()) {
return -ErrorCodes.ENOENT();
}
return node.link(name, targetNode);
}
示例3: mkdir
@Override
public int mkdir(String path, ModeWrapper mode) {
Node node = root.find(path);
if (node != null) {
return -ErrorCodes.EEXIST();
}
int pos = path.lastIndexOf('/');
if (pos < 0) {
return -ErrorCodes.ENOENT();
}
String name = path.substring(pos + 1);
if (name.length() < 1) {
return -ErrorCodes.ENOENT();
}
path = path.substring(0, pos);
if (path.length() < 1) {
path = "/";
}
node = root.find(path);
if (node == null || !node.isDir()) {
return -ErrorCodes.ENOENT();
}
return node.mkdir(name, mode);
}
示例4: symlink
@Override
public int symlink(String path, String target) {
Node node = root.find(target);
if (node != null) {
return -ErrorCodes.EEXIST();
}
int pos = target.lastIndexOf('/');
if (pos < 0) {
return -ErrorCodes.ENOENT();
}
String name = target.substring(pos + 1);
if (name.length() < 1) {
return -ErrorCodes.ENOENT();
}
String targetPath = target.substring(0, pos);
if (targetPath.length() < 1) {
targetPath = "/";
}
node = root.find(targetPath);
if (node == null || !node.isDir()) {
return -ErrorCodes.ENOENT();
}
return node.symlink(name, path);
}
示例5: create
@Override
public int create(final String path, final ModeWrapper mode, final FileInfoWrapper info)
{
if (getPath(path) != null) {
return -ErrorCodes.EEXIST();
}
final MemoryPath parent = getParentPath(path);
if (parent instanceof MemoryDirectory) {
((MemoryDirectory) parent).mkfile(getLastComponent(path));
return 0;
}
return -ErrorCodes.ENOENT();
}
示例6: mkdir
@Override
public int mkdir(final String path, final ModeWrapper mode)
{
if (getPath(path) != null) {
return -ErrorCodes.EEXIST();
}
final MemoryPath parent = getParentPath(path);
if (parent instanceof MemoryDirectory) {
((MemoryDirectory) parent).mkdir(getLastComponent(path));
return 0;
}
return -ErrorCodes.ENOENT();
}
示例7: create
@Override
public int create(String path, ModeWrapper mode, FileInfoWrapper info) {
if(gdrive.findPath(path, null) != null) return -ErrorCodes.EEXIST();
String parentname = path.substring(0, path.lastIndexOf('/'));
String name = path.substring(path.lastIndexOf('/') + 1);
Node parent = gdrive.findPath(parentname, null);
if (parent == null)
return -ErrorCodes.ENOENT();
gdrive.createFile(parent, name);
return 0;
}
示例8: mkdir
@Override
public int mkdir(String path, ModeWrapper mode) {
System.out.println("mkdir " + path);
if(gdrive.findPath(path, null) != null) return -ErrorCodes.EEXIST();
String parentname = path.substring(0, path.lastIndexOf('/'));
String name = path.substring(path.lastIndexOf('/') + 1);
Node parent = gdrive.findPath(parentname, null);
if (parent == null)
return -ErrorCodes.ENOENT();
gdrive.createDir(parent, name);
return 0;
}