Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-12-13 08:22:19 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-12-13 08:22:19 +0300
commit8ad2642c4717dcfad31626f7eebac325a9827b73 (patch)
tree2d2ba09f1cd3849adb45eb51a590783a5a9eca02 /source/blender/blenloader
parent27231afce5e4d0832113415f4d3cdeed480b165f (diff)
Cleanup: use "filepath" term for Main, BlendFileData & FileGlobal
Use "filepath" which is the current convention for naming full paths. - Main use "name" which isn't obviously a file path. - BlendFileData & FileGlobal used "filename" which is often used for the name component of a path (without the directory).
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/BLO_readfile.h2
-rw-r--r--source/blender/blenloader/intern/readfile.c24
-rw-r--r--source/blender/blenloader/intern/readfile_tempload.c2
-rw-r--r--source/blender/blenloader/intern/writefile.c10
4 files changed, 19 insertions, 19 deletions
diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h
index f86528db452..8fe0907deab 100644
--- a/source/blender/blenloader/BLO_readfile.h
+++ b/source/blender/blenloader/BLO_readfile.h
@@ -74,7 +74,7 @@ typedef struct BlendFileData {
int fileflags;
int globalf;
- char filename[1024]; /* 1024 = FILE_MAX */
+ char filepath[1024]; /* 1024 = FILE_MAX */
struct bScreen *curscreen; /* TODO: think this isn't needed anymore? */
struct Scene *curscene;
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 3532918c3b6..ed6687bfa38 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -631,7 +631,7 @@ static Main *blo_find_main(FileData *fd, const char *filepath, const char *relab
// printf("blo_find_main: converted to %s\n", name1);
for (m = mainlist->first; m; m = m->next) {
- const char *libname = (m->curlib) ? m->curlib->filepath_abs : m->name;
+ const char *libname = (m->curlib) ? m->curlib->filepath_abs : m->filepath;
if (BLI_path_cmp(name1, libname) == 0) {
if (G.debug & G_DEBUG) {
@@ -2848,7 +2848,7 @@ static void lib_link_library(BlendLibReader *UNUSED(reader), Library *UNUSED(lib
* in relation to the blend file. */
static void fix_relpaths_library(const char *basepath, Main *main)
{
- /* BLO_read_from_memory uses a blank filename */
+ /* #BLO_read_from_memory uses a blank file-path. */
if (basepath == NULL || basepath[0] == '\0') {
LISTBASE_FOREACH (Library *, lib, &main->libraries) {
/* when loading a linked lib into a file which has not been saved,
@@ -3502,25 +3502,25 @@ static BHead *read_global(BlendFileData *bfd, FileData *fd, BHead *bhead)
bfd->fileflags = fg->fileflags;
bfd->globalf = fg->globalf;
- BLI_strncpy(bfd->filename, fg->filename, sizeof(bfd->filename));
+ STRNCPY(bfd->filepath, fg->filepath);
- /* Error in 2.65 and older: main->name was not set if you save from startup
+ /* Error in 2.65 and older: `main->filepath` was not set if you save from startup
* (not after loading file). */
- if (bfd->filename[0] == 0) {
+ if (bfd->filepath[0] == 0) {
if (fd->fileversion < 265 || (fd->fileversion == 265 && fg->subversion < 1)) {
if ((G.fileflags & G_FILE_RECOVER_READ) == 0) {
- BLI_strncpy(bfd->filename, BKE_main_blendfile_path(bfd->main), sizeof(bfd->filename));
+ STRNCPY(bfd->filepath, BKE_main_blendfile_path(bfd->main));
}
}
- /* early 2.50 version patch - filename not in FileGlobal struct at all */
+ /* early 2.50 version patch - filepath not in FileGlobal struct at all */
if (fd->fileversion <= 250) {
- BLI_strncpy(bfd->filename, BKE_main_blendfile_path(bfd->main), sizeof(bfd->filename));
+ STRNCPY(bfd->filepath, BKE_main_blendfile_path(bfd->main));
}
}
if (G.fileflags & G_FILE_RECOVER_READ) {
- BLI_strncpy(fd->relabase, fg->filename, sizeof(fd->relabase));
+ BLI_strncpy(fd->relabase, fg->filepath, sizeof(fd->relabase));
}
bfd->curscreen = fg->curscreen;
@@ -3616,7 +3616,7 @@ static void do_versions_after_linking(Main *main, ReportList *reports)
CLOG_INFO(&LOG,
2,
"Processing %s (%s), %d.%d",
- main->curlib ? main->curlib->filepath : main->name,
+ main->curlib ? main->curlib->filepath : main->filepath,
main->curlib ? "LIB" : "MAIN",
main->versionfile,
main->subversionfile);
@@ -3854,7 +3854,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
if ((fd->skip_flags & BLO_READ_SKIP_DATA) == 0) {
BLI_addtail(&mainlist, bfd->main);
fd->mainlist = &mainlist;
- BLI_strncpy(bfd->main->name, filepath, sizeof(bfd->main->name));
+ STRNCPY(bfd->main->filepath, filepath);
}
if (G.background) {
@@ -4511,7 +4511,7 @@ static void split_main_newid(Main *mainptr, Main *main_newid)
/* We only copy the necessary subset of data in this temp main. */
main_newid->versionfile = mainptr->versionfile;
main_newid->subversionfile = mainptr->subversionfile;
- BLI_strncpy(main_newid->name, mainptr->name, sizeof(main_newid->name));
+ STRNCPY(main_newid->filepath, mainptr->filepath);
main_newid->curlib = mainptr->curlib;
ListBase *lbarray[INDEX_ID_MAX];
diff --git a/source/blender/blenloader/intern/readfile_tempload.c b/source/blender/blenloader/intern/readfile_tempload.c
index 1b1cbb29ef5..311732adf99 100644
--- a/source/blender/blenloader/intern/readfile_tempload.c
+++ b/source/blender/blenloader/intern/readfile_tempload.c
@@ -39,7 +39,7 @@ TempLibraryContext *BLO_library_temp_load_id(struct Main *real_main,
temp_lib_ctx->bf_reports.reports = reports;
/* Copy the file path so any path remapping is performed properly. */
- STRNCPY(temp_lib_ctx->bmain_base->name, real_main->name);
+ STRNCPY(temp_lib_ctx->bmain_base->filepath, real_main->filepath);
temp_lib_ctx->blendhandle = BLO_blendhandle_from_file(blend_file_path,
&temp_lib_ctx->bf_reports);
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index f8f5dab8797..45258a50961 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1028,7 +1028,7 @@ static void write_global(WriteData *wd, int fileflags, Main *mainvar)
/* prevent mem checkers from complaining */
memset(fg._pad, 0, sizeof(fg._pad));
- memset(fg.filename, 0, sizeof(fg.filename));
+ memset(fg.filepath, 0, sizeof(fg.filepath));
memset(fg.build_hash, 0, sizeof(fg.build_hash));
fg._pad1 = NULL;
@@ -1045,7 +1045,7 @@ static void write_global(WriteData *wd, int fileflags, Main *mainvar)
fg.globalf = G.f;
/* Write information needed for recovery. */
if (fileflags & G_FILE_RECOVER_WRITE) {
- BLI_strncpy(fg.filename, mainvar->name, sizeof(fg.filename));
+ STRNCPY(fg.filepath, mainvar->filepath);
}
sprintf(subvstr, "%4d", BLENDER_FILE_SUBVERSION);
memcpy(fg.subvstr, subvstr, 4);
@@ -1362,12 +1362,12 @@ bool BLO_write_file(Main *mainvar,
char dir_src[FILE_MAX];
char dir_dst[FILE_MAX];
- BLI_split_dir_part(mainvar->name, dir_src, sizeof(dir_src));
+ BLI_split_dir_part(mainvar->filepath, dir_src, sizeof(dir_src));
BLI_split_dir_part(filepath, dir_dst, sizeof(dir_dst));
/* Just in case there is some subtle difference. */
- BLI_path_normalize(mainvar->name, dir_dst);
- BLI_path_normalize(mainvar->name, dir_src);
+ BLI_path_normalize(mainvar->filepath, dir_dst);
+ BLI_path_normalize(mainvar->filepath, dir_src);
/* Only for relative, not relative-all, as this means making existing paths relative. */
if (remap_mode == BLO_WRITE_PATH_REMAP_RELATIVE) {