@@ -110,6 +110,38 @@ fern#fri#encode({str}[, {pattern}])
110
110
fern#fri#decode({str} )
111
111
Decode percent-encoding from the {str} .
112
112
113
+ *fern#fri#to#path()*
114
+ fern#fri#to#path({fri} )
115
+ Convert a FRI instance to a path.
116
+ It returns a decoded "path" attribute with a leading "/".
117
+
118
+ *fern#fri#to#filepath()*
119
+ fern#fri#to#filepath({fri} )
120
+ Convert a FRI instance of "file:// " protocol to a file path.
121
+ It returns a slash separated path on Linux/Unix and a backslash
122
+ separated path on Windows.
123
+ >
124
+ " How to get a file path from a fern buffer name.
125
+ let l:bufname = 'fern://file:///Users/alisue/wk/hello%252520world$'
126
+ let l:fri1 = fern#fri#parse(l:bufname)
127
+ let l:fri2 = fern#fri#parse(l:fri1.path)
128
+ echo fern#fri#to#filepath(l:fri2)
129
+ <
130
+ *fern#fri#from#path()*
131
+ fern#fri#from#path({path} )
132
+ Convert an absolute path to a FRI instance of "file:// " protocol.
133
+ It returns a FRI instance with "scheme" set to "file" and
134
+ "path" set to the {path} .
135
+
136
+ It assumes that the {path} is slash separated absolute path. Use
137
+ | fern#fri#from#filepath() | instead when the {path} is a file path.
138
+
139
+ *fern#fri#from#filepath()*
140
+ fern#fri#from#filepath({path} )
141
+ Convert an absolute file path to a FRI instance of "file:// " protocol.
142
+ It returns a FRI instance with "scheme" set to "file" and
143
+ "path" set to the slash separated {path} . The {path} is converted to
144
+ a slash separated path.
113
145
114
146
=============================================================================
115
147
NODE *fern-develop-node*
0 commit comments