Seed `buf` with the source file's directory (strip the basename) and * normalize backslashes. */
| 236 | /* Seed `buf` with the source file's directory (strip the basename) and |
| 237 | * normalize backslashes. */ |
| 238 | static void seed_source_dir(char *buf, size_t buf_size, const char *source_rel) { |
| 239 | snprintf(buf, buf_size, "%s", source_rel ? source_rel : ""); |
| 240 | for (char *p = buf; *p; p++) { |
| 241 | if (*p == '\\') { |
| 242 | *p = '/'; |
| 243 | } |
| 244 | } |
| 245 | char *last = strrchr(buf, '/'); |
| 246 | if (last) { |
| 247 | *last = '\0'; |
| 248 | } else { |
| 249 | buf[0] = '\0'; |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | /* Detect the flavor of relative import based on the leading characters. |
| 254 | * Returns 1 for Python dotted form (e.g. ".foo" or "..bar.baz"), |
no outgoing calls
no test coverage detected