diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2025-03-25 10:33:28 -0400 | 
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2025-03-25 10:33:28 -0400 | 
| commit | f8ed92d6257196869315e29d454e86e13453452e (patch) | |
| tree | 7439c3c842b64455615b41073139c2e11751ecce /src | |
| parent | 5da81c51855b99bc8118d15dce7b8063af8a9afe (diff) | |
| download | stasis-f8ed92d6257196869315e29d454e86e13453452e.tar.gz | |
Converts file system path to file:// path
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/core/conda.c | 13 | 
1 files changed, 12 insertions, 1 deletions
diff --git a/src/lib/core/conda.c b/src/lib/core/conda.c index 80d280a..9b5c77c 100644 --- a/src/lib/core/conda.c +++ b/src/lib/core/conda.c @@ -500,7 +500,18 @@ int conda_setup_headless() {  int conda_env_create_from_uri(char *name, char *uri) {      char env_command[PATH_MAX]; -    sprintf(env_command, "env create -n %s -f %s", name, uri); +    char *uri_fs = NULL; + +    // Convert a bare system path to a file:// path +    if (!strstr(uri, "://")) { +        uri_fs = calloc(strlen(uri) + strlen("file://") + 1, sizeof(*uri_fs)); +        if (!uri_fs) { +            return -1; +        } +        snprintf(uri_fs, strlen(uri) + strlen("file://") + 1, "%s%s", "file://", uri); +    } +    sprintf(env_command, "env create -n '%s' --file='%s'", name, uri_fs ? uri_fs : uri); +    guard_free(uri_fs);      return conda_exec(env_command);  }  | 
