MCPcopy Create free account
hub / github.com/ValveSoftware/Proton / steamclient_dos_to_unix_path_array

Function steamclient_dos_to_unix_path_array

lsteamclient/unixlib.cpp:1047–1091  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1045}
1046
1047const char **steamclient_dos_to_unix_path_array( const char **src )
1048{
1049 size_t len;
1050 const char **s;
1051 char **out, **o;
1052 WCHAR scratch[PATH_MAX] = {'\\', '?', '?', '\\', 0};
1053
1054 TRACE( "src %p\n", src );
1055
1056 if (!src) return NULL;
1057
1058 len = sizeof(char *); /* NUL */
1059 for (s = src; *s; ++s) len += sizeof(char *);
1060
1061 out = (char **)malloc( len );
1062
1063 for (s = src, o = out; *s; ++s, ++o)
1064 {
1065 TRACE( " src[%zu] %s\n", s - src, debugstr_a(*s) );
1066 if (IS_ABSOLUTE( *s ))
1067 {
1068 ntdll_umbstowcs( *s, strlen( *s ) + 1, scratch + 4, PATH_MAX - 4 );
1069 collapse_path( scratch, 4 );
1070 *o = get_unix_file_name( scratch );
1071 }
1072 else
1073 {
1074 const char *r;
1075 char *l;
1076 *o = (char *)malloc( strlen( *s ) + 1 );
1077 for (r = *s, l = *o; *r; ++l, ++r)
1078 {
1079 if (*r == '\\') *l = '/';
1080 else *l = *r;
1081 }
1082 *l = 0;
1083 }
1084 TRACE( " -> %s\n", debugstr_a(*o) );
1085 }
1086
1087 *o = NULL;
1088
1089 TRACE( " -> %p\n", out );
1090 return (const char **)out;
1091}
1092
1093const char **wow64_steamclient_dos_to_unix_path_array( ptr32< const char ** > src_array )
1094{

Calls 2

collapse_pathFunction · 0.85
get_unix_file_nameFunction · 0.85

Tested by

no test coverage detected