forked from bartvdbraak/blender
use macro for access to library filepath
This commit is contained in:
parent
a6828b9c6f
commit
1d225c6696
@ -362,7 +362,7 @@ static int rewrite_path_alloc(char **path, BPathVisitor visit_cb, const char *ab
|
||||
void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
|
||||
{
|
||||
Image *ima;
|
||||
const char *absbase= (flag & BPATH_TRAVERSE_ABS) ? (id->lib ? id->lib->filepath : bmain->name) : NULL;
|
||||
const char *absbase= (flag & BPATH_TRAVERSE_ABS) ? ID_BLEND_PATH(bmain, id) : NULL;
|
||||
|
||||
if ((flag & BPATH_TRAVERSE_SKIP_LIBRARY) && id->lib) {
|
||||
return;
|
||||
|
@ -100,7 +100,7 @@ static int file_browse_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
FileBrowseOp *fbo= op->customdata;
|
||||
ID *id;
|
||||
char *base, *str, path[FILE_MAX];
|
||||
char *str, path[FILE_MAX];
|
||||
const char *path_prop= RNA_struct_find_property(op->ptr, "directory") ? "directory" : "filepath";
|
||||
|
||||
if (RNA_property_is_set(op->ptr, path_prop)==0 || fbo==NULL)
|
||||
@ -113,10 +113,9 @@ static int file_browse_exec(bContext *C, wmOperator *op)
|
||||
char name[FILE_MAX];
|
||||
|
||||
id = fbo->ptr.id.data;
|
||||
base = (id && id->lib)? id->lib->filepath: G.main->name;
|
||||
|
||||
BLI_strncpy(path, str, FILE_MAX);
|
||||
BLI_path_abs(path, base);
|
||||
BLI_path_abs(path, id ? ID_BLEND_PATH(G.main, id) : G.main->name);
|
||||
|
||||
if(BLI_is_dir(path)) {
|
||||
str = MEM_reallocN(str, strlen(str)+2);
|
||||
|
@ -733,7 +733,7 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re
|
||||
/* send the OnSave event */
|
||||
for (li= G.main->library.first; li; li= li->id.next) {
|
||||
if (BLI_path_cmp(li->filepath, filepath) == 0) {
|
||||
BKE_reportf(reports, RPT_ERROR, "Can't overwrite used library '%.200s'", filepath);
|
||||
BKE_reportf(reports, RPT_ERROR, "Can't overwrite used library '%.240s'", filepath);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user