use tmp subdirectory to group web schematics
This commit is contained in:
parent
c9380bd8f0
commit
8f6aaa0ec2
|
|
@ -1326,7 +1326,7 @@ int descend_schematic(int instnumber)
|
|||
strstr(xctx->current_dirname, "https://") == xctx->current_dirname) {
|
||||
char sympath[PATH_MAX];
|
||||
tclvareval("try_download_url {", xctx->current_dirname, "} {", filename, "}", NULL);
|
||||
my_snprintf(sympath, S(sympath), "%s/%s", tclgetvar("XSCHEM_TMP_DIR"), get_cell_w_ext(filename, 0));
|
||||
my_snprintf(sympath, S(sympath), "%s/xschem_web/%s", tclgetvar("XSCHEM_TMP_DIR"), get_cell_w_ext(filename, 0));
|
||||
load_schematic(1, sympath, 1);
|
||||
} else {
|
||||
load_schematic(1, filename, 1);
|
||||
|
|
|
|||
11
src/save.c
11
src/save.c
|
|
@ -2164,14 +2164,17 @@ void load_schematic(int load_symbols, const char *fname, int reset_undo) /* 2015
|
|||
if(strstr(filename , "http://") == filename ||
|
||||
strstr(filename , "https://") == filename) {
|
||||
tclvareval("download_url {", filename, "}", NULL);
|
||||
my_snprintf(name, S(name), "%s/%s", tclgetvar("XSCHEM_TMP_DIR"), get_cell_w_ext(filename, 0));
|
||||
my_snprintf(name, S(name), "%s/xschem_web/%s", tclgetvar("XSCHEM_TMP_DIR"), get_cell_w_ext(filename, 0));
|
||||
my_snprintf(msg, S(msg), "regsub {/\\.$} [get_directory {%s}] {}", filename);
|
||||
my_strncpy(xctx->current_dirname, tcleval(msg), S(xctx->current_dirname));
|
||||
dbg(1, "load_schematic(): filename=%s\n", filename);
|
||||
my_strncpy(xctx->sch[xctx->currsch], name, S(xctx->sch[xctx->currsch]));
|
||||
my_strncpy(xctx->current_name, rel_sym_path(name), S(xctx->current_name));
|
||||
} else if(xctx->currsch > 0 && (strstr(xctx->current_dirname, "http://") == xctx->current_dirname ||
|
||||
} else if(/* xctx->currsch > 0 && */ (strstr(xctx->current_dirname, "http://") == xctx->current_dirname ||
|
||||
strstr(xctx->current_dirname, "https://") == xctx->current_dirname)) {
|
||||
if(!strstr(filename, "/tmp/xschem_web")) {
|
||||
my_snprintf(msg, S(msg), "regsub {/\\.$} [get_directory {%s}] {}", filename);
|
||||
my_strncpy(xctx->current_dirname, tcleval(msg), S(xctx->current_dirname));
|
||||
}
|
||||
my_strncpy(xctx->sch[xctx->currsch], filename, S(xctx->sch[xctx->currsch]));
|
||||
my_strncpy(xctx->current_name, rel_sym_path(filename), S(xctx->current_name));
|
||||
} else {
|
||||
|
|
@ -2863,7 +2866,7 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
|||
if( strstr(xctx->current_dirname, "http://") == xctx->current_dirname ||
|
||||
strstr(xctx->current_dirname, "https://") == xctx->current_dirname) {
|
||||
tclvareval("try_download_url {", xctx->current_dirname, "} {", name, "}", NULL);
|
||||
my_snprintf(sympath, S(sympath), "%s/%s", tclgetvar("XSCHEM_TMP_DIR"), get_cell_w_ext(name, 0));
|
||||
my_snprintf(sympath, S(sympath), "%s/xschem_web/%s", tclgetvar("XSCHEM_TMP_DIR"), get_cell_w_ext(name, 0));
|
||||
lcc[level].fd=fopen(sympath,fopen_read_mode);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4435,7 +4435,10 @@ proc get_directory {f} {
|
|||
|
||||
proc download_url {url} {
|
||||
global XSCHEM_TMP_DIR download_url_helper
|
||||
set r [catch {exec sh -c "cd $XSCHEM_TMP_DIR; $download_url_helper $url"} res]
|
||||
if {![file exists ${XSCHEM_TMP_DIR}/xschem_web]} {
|
||||
file mkdir ${XSCHEM_TMP_DIR}/xschem_web
|
||||
}
|
||||
set r [catch {exec sh -c "cd ${XSCHEM_TMP_DIR}/xschem_web; $download_url_helper $url"} res]
|
||||
# puts "download_url: url=$url, exit code=$r, res=$res"
|
||||
return $r
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue