English 中文(简体)
档案计划及相关档案
原标题:File Uri Scheme and Relative Files

假设安葬计划是“档案”。 还认为这条道路始于......。

An example path is ./.bashrc . How would the fulluri look? file://./.bashrc appears odd to me.

最佳回答

简言之,URL文件采取下列形式:

file://localhost/absolute/path/to/file [ok]

or you can omit the host (but not the slash):

file:///absolute/path/to/file [ok]

但这并不是:

file://file_at_current_dir [no way]

否则:

file://./file_at_current_dir [no way]

我刚刚证实,通过Sald urllib2.urlopen()

http://en.wikipedia.org/wiki/File_URI_scheme>。

"file:///foo.txt" is okay, while "file://foo.txt" is not,
although some interpreters manage to handle the latter
问题回答

不可能使用全部档案:URI有,有,有,有的放矢,没有这条道路的根基。 您是否使用文件http://./.bashrc或文档http:///.bashrc。 这些道路将毫无意义。 如果你想要使用一种相对联系,则不用礼宾/授权部分使用:

<a href="./.bashrc">link</a>

如果你想充分利用国际独立人士协会,你必须说明你相对的道路是:

<a href="file:///home/kindrik/./.bashrc">link</a>

http://www.rfc-editor.org/rfc/rfc3986“rel=“nofollow noreferer” 题目=“RFC 3986”

The path segments "." and "..", also known as dot-segments, are
defined for relative reference within the path name hierarchy.  They
are intended for use at the beginning of a relative-path reference
(Section 4.2) to indicate relative position within the hierarchical
tree of names.  This is similar to their role within some operating
systems  file directory structures to indicate the current directory
and parent directory, respectively.  However, unlike in a file
system, these dot-segments are only interpreted within the URI path
hierarchy and are removed as part of the resolution process (Section
5.2).

The complete path segments "." and ".." are intended only for use
within relative references (Section 4.1) and are removed as part of
the reference resolution process (Section 5.2).  However, some
deployed implementations incorrectly assume that reference resolution
is not necessary when the reference is already a URI and thus fail to
remove dot-segments when they occur in non-relative paths.  URI
normalizers should remove dot-segments by applying the
remove_dot_segments algorithm to the path, as described in Section 5.2.4.

The complete path segments "." and ".." are intended only for use
within relative references (Section 4.1) and are removed as part of
the reference resolution process (Section 5.2) 

RFC 3986甚至描述了消除这些“......”和“......”的算法。

在一个终点站,你可以使用“PWD”的“笔记:笔记”。

You should not put double slash after file:. Correct form is

 file:.bashrc 

RFC 3986 。 定义

I don t know your use case.

我在《标准法典》中也有类似需要,因此,当我需要一份与我的工作名录有关的文件时,我就这样创造了一种ur。

const url = "file://" + process.cwd() + "/" + ".bashrc";

在一张单张的文字中,我设法做到了这一点:

file://`pwd`/relative-path

在你的具体情况下:

file://`pwd`/.bashrc

有一个可能有助于的工作。

如果在发展阶段,你只能指明相对的档案途径,但需要使用《欧洲刑法》(这要求了解绝对的道路)这样的代码:

new File("relative/path/to/file").toURI().toURL();

有了你,URL就在相对的道路上看着档案。





相关问题
How can I load a folders files into a ListView?

I d like to have a user select a folder with the FolderBrowserDialog and have the files loaded into the ListView. My intention is to make a little playlist of sorts so I have to modify a couple of ...

File Handling Issue

I am developing a tool in c#, at one instance I start writing into a xml file continuously using my tool,when i suddenly restart my machine the particular xml file gets corrupted, what is the reason ...

C# GemBox Excel Import Error

I am trying to import an excel file into a data table using GemBox and I keep getting this error: Invalid data value when extracting to DataTable at SourceRowIndex: 1, and SourceColumnIndex: 1. As ...

Saving output of a for-loop to file

I have opened a file with blast results and printed out the hits in fasta format to the screen. The code looks like this: result_handle = open("/Users/jonbra/Desktop/my_blast.xml") from Bio.Blast ...

热门标签