URI 체계가 "파일"이라고 가정합니다. 또한 경로가 '.'로 시작한다고 가정합니다.파일 URI 체계 및 관련 파일
경로의 예로는 './.bashrc'가 있습니다. 풀 루리는 어떻게 보이나요? 'file : //./.bashrc'는 이상하게 보입니다. 한마디로
URI 체계가 "파일"이라고 가정합니다. 또한 경로가 '.'로 시작한다고 가정합니다.파일 URI 체계 및 관련 파일
경로의 예로는 './.bashrc'가 있습니다. 풀 루리는 어떻게 보이나요? 'file : //./.bashrc'는 이상하게 보입니다. 한마디로
는 파일의 URL은의 형태로 취
file://localhost/absolute/path/to/file [ok]
를하거나 호스트 (그러나 슬래시) 생략 할 수 있습니다 :
file:///absolute/path/to/file [ok]
하지만이 :
file://file_at_current_dir [no way]
을
도 아니다 :
file://./file_at_current_dir [no way]
난 그냥 확인이 파이썬의 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
파일 프로토콜에 대한 권한을 제거 할 수 있기 때문에 file :/absolute/path 또는 file : relative를 사용할 수도 있습니까 (작동하지 않지만). –
은 전체 파일을 사용하는 것은 불가능하다 : '.'URI를 함께 또는 경로의 루트 부분이없는 경로의 '..'세그먼트 'file : //./.bashrc'또는 'file : ///./.bashrc'를 사용하든 이러한 경로는 의미가 없습니다. 당신이 상대 링크를 사용하려면 프로토콜/권한 부분없이 사용할 :
<a href="file:///home/kindrik/./.bashrc">link</a>
: 당신이 전체 URI를 사용하려면
<a href="./.bashrc">link</a>
, 당신은 당신의 상대 경로가되는 루트 상대를 알려야합니다 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에 따르면
이 제거 심지어 알고리즘을 설명합니다 "." 및 ".."URI에서.
터미널에서 "$ PWD"를 사용하여 "file : //$PWD/.bashrc"를 입력하여 현재 디렉토리를 나타낼 수 있습니다.
내 코드에서 바꾸기 – wener
이것은 상대 경로에서도 잘 작동합니다. "file : //$PWD/../parentchilddir/somefile.txt" – nilsmagnus
Wikipedia http://en.wikipedia.org/wiki/Uniform_resource_identifier에 따르면 당신은 상대적으로 참조 할 때 그 구성표를 생략하고 "./.bashrc"를 URI로 사용할 수 있습니다. 그러나 이것은 단지 추측이며, 그것이 실제로 어떻게 작동하는지 확실하지 않습니다. – Tony
@ 토니 - 고마워요 .docx 파일에서 상대 참조를 만들기 위해 잘 작동합니다 - 단지 압축을 풀고 "file : /// long-absolute-path/relative-path"참조를 찾고 "relative-path"로 바꾸십시오 – tucuxi
URI는 백분율 기호 (예 :'% 20' = space)로 인코딩 된 특수 문자를 가질 수 있으므로 접두어를 엄격하게 생략하는 것이 항상 효과가있는 것은 아닙니다. 응용 프로그램에 따라 이스케이프 된 문자를 실제 표현으로 대체해야 할 수 있습니다. – sleblanc