Changeset View
Changeset View
Standalone View
Standalone View
source/lib/file/vfs/vfs_populate.cpp
/* Copyright (C) 2021 Wildfire Games. | /* Copyright (C) 2021 Wildfire Games. | ||||
Lint: Inaccurate Copyright Year: Inaccurate Copyright Year | |||||
* | * | ||||
* Permission is hereby granted, free of charge, to any person obtaining | * Permission is hereby granted, free of charge, to any person obtaining | ||||
* a copy of this software and associated documentation files (the | * a copy of this software and associated documentation files (the | ||||
* "Software"), to deal in the Software without restriction, including | * "Software"), to deal in the Software without restriction, including | ||||
* without limitation the rights to use, copy, modify, merge, publish, | * without limitation the rights to use, copy, modify, merge, publish, | ||||
* distribute, sublicense, and/or sell copies of the Software, and to | * distribute, sublicense, and/or sell copies of the Software, and to | ||||
* permit persons to whom the Software is furnished to do so, subject to | * permit persons to whom the Software is furnished to do so, subject to | ||||
* the following conditions: | * the following conditions: | ||||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | if(name.Extension() == L".DELETED") | ||||
m_directory->DeleteSubtree(file); | m_directory->DeleteSubtree(file); | ||||
if(!(m_realDirectory->Flags() & VFS_MOUNT_KEEP_DELETED)) | if(!(m_realDirectory->Flags() & VFS_MOUNT_KEEP_DELETED)) | ||||
return; | return; | ||||
} | } | ||||
m_directory->AddFile(file); | m_directory->AddFile(file); | ||||
} | } | ||||
static void AddArchiveFile(const VfsPath& pathname, const CFileInfo& fileInfo, PIArchiveFile archiveFile, uintptr_t cbData) | static Status AddArchiveFile(const VfsPath& pathname, const CFileInfo& fileInfo, PIArchiveFile archiveFile, uintptr_t cbData) | ||||
{ | { | ||||
PopulateHelper* this_ = (PopulateHelper*)cbData; | PopulateHelper* this_ = (PopulateHelper*)cbData; | ||||
// (we have to create missing subdirectoryNames because archivers | // (we have to create missing subdirectoryNames because archivers | ||||
// don't always place directory entries before their files) | // don't always place directory entries before their files) | ||||
const size_t flags = VFS_LOOKUP_ADD|VFS_LOOKUP_SKIP_POPULATE; | const size_t flags = VFS_LOOKUP_ADD|VFS_LOOKUP_SKIP_POPULATE; | ||||
VfsDirectory* directory; | VfsDirectory* directory; | ||||
WARN_IF_ERR(vfs_Lookup(pathname, this_->m_directory, directory, 0, flags)); | RETURN_STATUS_IF_ERR(vfs_Lookup(pathname, this_->m_directory, directory, 0, flags)); | ||||
const VfsPath name = fileInfo.Name(); | const VfsPath name = fileInfo.Name(); | ||||
const VfsFile file(name, (size_t)fileInfo.Size(), fileInfo.MTime(), this_->m_realDirectory->Priority(), archiveFile); | const VfsFile file(name, (size_t)fileInfo.Size(), fileInfo.MTime(), this_->m_realDirectory->Priority(), archiveFile); | ||||
if(name.Extension() == L".DELETED") | if(name.Extension() == L".DELETED") | ||||
{ | { | ||||
directory->DeleteSubtree(file); | directory->DeleteSubtree(file); | ||||
if(!(this_->m_realDirectory->Flags() & VFS_MOUNT_KEEP_DELETED)) | if(!(this_->m_realDirectory->Flags() & VFS_MOUNT_KEEP_DELETED)) | ||||
return; | return INFO::OK; | ||||
StanUnsubmitted Not Done Inline ActionsWonder if it should be INFO:SKIPPED since we skip .DELETED files, but we also process them... Stan: Wonder if it should be `INFO:SKIPPED` since we skip .DELETED files, but we also process them... | |||||
} | } | ||||
directory->AddFile(file); | directory->AddFile(file); | ||||
return INFO::OK; | |||||
} | } | ||||
Status AddFiles(const CFileInfos& files) const | Status AddFiles(const CFileInfos& files) const | ||||
{ | { | ||||
const OsPath path(m_realDirectory->Path()); | const OsPath path(m_realDirectory->Path()); | ||||
for(size_t i = 0; i < files.size(); i++) | for(size_t i = 0; i < files.size(); i++) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 81 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Inaccurate Copyright Year