Skip only ESD files in WindowsESD
This commit is contained in:
1 parent
9c1db67b8c
commit
a69409e526
2 files changed
+31
-4
No files matched your search
@@ -35,7 +35,7 @@ build\Release\ParavisInstaller.exe
|
||||
- Разметка через diskpart: FAT32 `PARAVIS` 16 ГБ, FAT `VTOYEFI` 32 МБ,
|
||||
exFAT `DATA` (оставшийся объём).
|
||||
- Галочка «Не копировать Windows ESD» (по умолчанию снята): если включить,
|
||||
папка `WindowsESD` из образа 3 после распаковки удаляется с раздела DATA.
|
||||
папка `WindowsESD` копируется, но файлы `*.esd` из неё удаляются с DATA.
|
||||
- Отключённый диск переводится в онлайн перед разметкой.
|
||||
- Проверка разметки по таблице разделов и меткам томов.
|
||||
- Распаковка DISM: образ 1 → `PARAVIS`, 2 → `VTOYEFI`, 3 → `DATA`, с
|
||||
|
||||
+30
-3
@@ -225,7 +225,8 @@ void App::Apply()
|
||||
message += L"Затем на разделы будут распакованы файлы из архива Data.pf\r\n";
|
||||
message += L"(1 -> PARAVIS, 2 -> VTOYEFI, 3 -> DATA).\r\n\r\n";
|
||||
if (noEsd) {
|
||||
message += L"Папка WindowsESD на раздел DATA копироваться не будет.\r\n\r\n";
|
||||
message += L"Файлы *.esd из папки WindowsESD копироваться не будут\r\n";
|
||||
message += L"(остальные файлы папки будут скопированы).\r\n\r\n";
|
||||
}
|
||||
message += L"ВНИМАНИЕ! ВСЕ ДАННЫЕ НА ЭТОМ ДИСКЕ БУДУТ УНИЧТОЖЕНЫ.\r\n";
|
||||
message += L"Продолжить?";
|
||||
@@ -458,8 +459,34 @@ int App::ApplyImages(int disk, const std::wstring& wim)
|
||||
if (i == 2 && noEsd) {
|
||||
std::wstring esdDir = dir + L"WindowsESD";
|
||||
std::error_code ec;
|
||||
std::filesystem::remove_all(esdDir, ec);
|
||||
DebugLog(L"skip WindowsESD: remove_all %s ec=%d", esdDir.c_str(), ec.value());
|
||||
if (std::filesystem::exists(esdDir, ec)) {
|
||||
std::filesystem::recursive_directory_iterator it(
|
||||
esdDir, std::filesystem::directory_options::skip_permission_denied, ec);
|
||||
const std::filesystem::recursive_directory_iterator end;
|
||||
while (it != end) {
|
||||
if (ec) {
|
||||
DebugLog(L"skip ESD: scan stopped ec=%d", ec.value());
|
||||
break;
|
||||
}
|
||||
const std::filesystem::directory_entry& entry = *it;
|
||||
std::error_code fileEc;
|
||||
if (entry.is_regular_file(fileEc)) {
|
||||
std::wstring ext = entry.path().extension().wstring();
|
||||
std::transform(ext.begin(), ext.end(), ext.begin(),
|
||||
[](wchar_t c) {
|
||||
return static_cast<wchar_t>(towlower(c));
|
||||
});
|
||||
if (ext == L".esd") {
|
||||
std::error_code removeEc;
|
||||
std::filesystem::remove(entry.path(), removeEc);
|
||||
DebugLog(L"skip ESD: %s removed=%d ec=%d",
|
||||
entry.path().c_str(),
|
||||
removeEc ? 0 : 1, removeEc.value());
|
||||
}
|
||||
}
|
||||
it.increment(ec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
++applied;
|
||||
|
||||
Reference in new issue
Block a user