[MPlayer-cvslog] r25556 - trunk/libmenu/menu_filesel.c
Zuxy Meng
zuxy.meng at gmail.com
Mon Jan 14 11:11:41 CET 2008
"Ulion" <ulion2002 at gmail.com> 写入消息新闻:81b02f020801100447s22395fe7ic916daa8705d555b at mail.gmail.com...
> 2008/1/9, Zuxy Meng <zuxy.meng at gmail.com>:
>> Hi,
>>
>> "ulion" <subversion at mplayerhq.hu> 写入消息新闻:20071231012050.DE8553B1ED at natsuki.mplayerhq.hu...
>> > Author: ulion
>> > Date: Mon Dec 31 02:20:50 2007
>> > New Revision: 25556
>> >
>> > Log:
>> > Default use the dir where the current playing file located if path not set.
>> >
>> >
>> > Modified:
>> > trunk/libmenu/menu_filesel.c
>> >
>> > Modified: trunk/libmenu/menu_filesel.c
>> > ==============================================================================
>> > --- trunk/libmenu/menu_filesel.c (original)
>> > +++ trunk/libmenu/menu_filesel.c Mon Dec 31 02:20:50 2007
>> > @@ -31,6 +31,7 @@
>> >
>> > int menu_keepdir = 0;
>> > char *menu_chroot = NULL;
>> > +extern char *filename;
>> >
>> > struct list_entry_s {
>> > struct list_entry p;
>> > @@ -425,8 +426,21 @@ static int open_fs(menu_t* menu, char* a
>> > }
>> >
>> > getcwd(wd,PATH_MAX);
>> > - if (!path || path[0] == '\0')
>> > - path = wd;
>> > + if (!path || path[0] == '\0') {
>> > + char *slash = NULL;
>> > + if (filename && !strstr(filename, "://") && (path=realpath(filename, b))) {
>>
>> realpath() breaks MinGW build and what's more, it's by design unsafe. Please find a better way to deal with this.
>>
>> > + slash = strrchr(path, '/');
>> > +#if defined(__MINGW32__) || defined(__CYGWIN__)
>> > + // FIXME: Do we need and can convert all '\\' in path to '/' on win32?
>> > + if (!slash)
>> > + slash = strrchr(path, '\\');
>> > +#endif
>> > + }
>> > + if (slash)
>> > + slash[1] = '\0';
>> > + else
>> > + path = wd;
>> > + }
>> > if (path[0] != '/') {
>> > if(path[strlen(path)-1] != '/')
>> > snprintf(b,sizeof(b),"%s/%s/",wd,path);
>>
>> Anyway, has this patch been reviewed ever?
>
> OK, that part of code was denied now. Then you may implement it in a
> better way if you'd like to. By now I have little time work on it and
> also have no idea of a better implementation.
I don't know what's the best to replace realpath(). Maybe ppl on the devel mailing list will have a better idea.
--
Zuxy
More information about the MPlayer-cvslog
mailing list