File tree Expand file tree Collapse file tree 1 file changed +10
-17
lines changed
Expand file tree Collapse file tree 1 file changed +10
-17
lines changed Original file line number Diff line number Diff line change @@ -912,26 +912,19 @@ xy_normalize_path (const char *path)
912912{
913913 char * new = xy_str_strip (path ); // 防止开发者多写了空白符
914914
915- if (xy_on_windows )
915+ if (xy_str_start_with ( new , "~" ) )
916916 {
917- if (xy_str_start_with (new , "~/" ))
918- {
919- // 或 %USERPROFILE%
920- new = xy_strjoin (3 , xy_os_home , "\\" ,
921- xy_str_delete_prefix (new , "~/" ));
922- }
923- new = xy_str_gsub (new , "/" , "\\" );
924- }
925- else
926- {
927- if (xy_str_start_with (new , "~/" ))
928- {
929- new = xy_strjoin (3 , xy_os_home , "/" ,
930- xy_str_delete_prefix (new , "~/" ));
931- }
917+ new = xy_strjoin (3 , xy_os_home , "/" ,
918+ xy_str_delete_prefix (new , "~" ));
932919 }
933920
934- return new ;
921+ new = xy_str_gsub (new , "\\" , "/" );
922+ new = xy_str_gsub (new , "//" , "/" );
923+
924+ if (xy_on_windows )
925+ return xy_str_gsub (new , "/" , "\\" );
926+ else
927+ return new ;
935928}
936929
937930static char *
You can’t perform that action at this time.
0 commit comments