Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
3bb3090a
Commit
3bb3090a
authored
Jul 12, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make_URI: handle Windows UNC paths
(cherry picked from commit
644185a5
)
parent
2bc45f5c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
7 deletions
+30
-7
src/test/url.c
src/test/url.c
+2
-1
src/text/strings.c
src/text/strings.c
+28
-6
No files found.
src/test/url.c
View file @
3bb3090a
...
...
@@ -108,7 +108,8 @@ int main (void)
test_path
(
"/"
,
"file:///"
);
test_path
(
"/home/john/"
,
"file:///home/john/"
);
test_path
(
"/home/john/music.ogg"
,
"file:///home/john/music.ogg"
);
//test_path ("\\\\server/pub/music.ogg", "file://server/pub/music.ogg");
test_path
(
"
\\\\
server/pub/music.ogg"
,
"smb://server/pub/music.ogg"
);
test_path
(
"
\\\\
server
\\
pub
\\
music.ogg"
,
"smb://server/pub/music.ogg"
);
/*int fd = open (".", O_RDONLY);
assert (fd != -1);*/
...
...
src/text/strings.c
View file @
3bb3090a
...
...
@@ -1079,15 +1079,37 @@ char *make_URI (const char *path)
}
else
#endif
#if 0
/* Windows UNC paths (file://host/share/path instead of file:///path) */
if
(
!
strncmp
(
path
,
"
\\\\
"
,
2
))
{
path += 2;
buf = strdup ("file://");
{
/* Windows UNC paths */
#ifndef WIN32
/* \\host\share\path -> smb://host/share/path */
if
(
strchr
(
path
+
2
,
'\\'
)
!=
NULL
)
{
/* Convert antislashes to slashes */
char
*
dup
=
strdup
(
path
);
if
(
dup
==
NULL
)
return
NULL
;
for
(
size_t
i
=
2
;
dup
[
i
];
i
++
)
if
(
dup
[
i
]
==
'\\'
)
dup
[
i
]
=
DIR_SEP_CHAR
;
char
*
ret
=
make_URI
(
dup
);
free
(
dup
);
return
ret
;
}
# define SMB_SCHEME "smb"
#else
/* \\host\share\path -> file://host/share/path */
# define SMB_SCHEME "file"
#endif
size_t
hostlen
=
strcspn
(
path
+
2
,
DIR_SEP
);
buf
=
malloc
(
sizeof
(
SMB_SCHEME
)
+
3
+
hostlen
);
if
(
buf
!=
NULL
)
snprintf
(
buf
,
sizeof
(
SMB_SCHEME
)
+
3
+
hostlen
,
SMB_SCHEME
"://%s"
,
path
+
2
);
path
+=
2
+
hostlen
;
}
else
#endif
if
(
path
[
0
]
!=
DIR_SEP_CHAR
)
{
/* Relative path: prepend the current working directory */
char
cwd
[
PATH_MAX
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment