English 中文(简体)
解决标准目录之外的相对途径(申请目录、桌面名录等)
原标题:Resolving relative paths outside the standard directories (applicationDirectory, desktopDirectory, etc)

我需要查阅与我的申请目录有关的档案,但正如文件中所述:

No.“......> 凡是达到档案系统根基或符合申请的储存深层的,都不得掉;。

但奇怪的是,如果我这样做的话。

File.applicationDirectory.resolvePath("/home/myHome/");

我可以进入档案系统中任何地方。

My question is: is there a workaround to navigate from my applicationDirectory to a relative path like "../../my.cfg" ?? (I need to read a config file generated by a different application)

最佳回答

如果你试图获得特权,那么你就不能这样做。

在其他情况下,则尝试进行下一次“家庭/blah/blah/./.my.cfg”的研究,并再次研究

你们也有另外几种方式:与你的档案建立链接,或操作外部面目/带。

问题回答

我以前曾用过Eugene s的答复中提到的小ck,从绝对的道路上复制:

var file =  C:UsersUser1Picturespic.png ;
var newPath = air.File.applicationStorageDirectory.resolvePath( images/pic.png );

air.File.applicationDirectory.resolvePath( /../../../../../../../../../../  +
  file).copyTo(newPath, true);

然而,这是w。 a. 改进工作方式:

var file =  C:UsersUser1Picturespic.png ;
var newPath = air.File.applicationStorageDirectory.resolvePath( images/pic.png );

new air.File(file).copyTo(newPath, true);




相关问题
Java shell expansion similar to wordexp

Is there a way to do shell wildcard expansion in java similar to the way that the C function call wordexp works? It seems a bit platform specific, but there has to be a nice abstraction for this in ...

How to evaluate a file system?

I ve a question related to design of file systems. These days we are seeing the proliferation of many file systems mostly related to handling large datasets and providing high availability and speed. ...

Storing files on the Cloud or the FileSystem? [closed]

Simple question, doesn t seem to have been directly asked yet. What are the benefits to storing files (images/videos/documents/etc) on Amazon S3-and-related vs. on the File System your app is ...

Is this specific path concatenation in Perl code exploitable?

Assume that an attacker controls the variable $untrusted_user_supplied_path. Is the following Perl code exploitable? my $untrusted_user_supplied_path = ... if ($untrusted_user_supplied_path =~ /../)...

How to determine how much free space on a drive in Qt?

I m using Qt and want a platform-independent way of getting the available free disk space. I know in Linux I can use statfs and in Windows I can use GetDiskFreeSpaceEx(). I know boost has a way, ...

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签