From c5eaa1bda4dcb212fd8db283efb624512a639410 Mon Sep 17 00:00:00 2001 From: sussjb99 Date: Thu, 9 Apr 2026 14:38:34 -0400 Subject: [PATCH 1/3] Enable command line processing of filelists I require par2.exe to accommodate processing files stored in a text file. My patch to facilitate this this functionality are in the commandline.cpp file. I have converted the Windows CR/LF to /LF so hopefully my version of this file will work properly with github. Thank sussjb99. Add files via upload Implements: #273 Closes: #274 --- src/commandline.cpp | 62 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 7 deletions(-) diff --git a/src/commandline.cpp b/src/commandline.cpp index d9b3b5c5..f8d648be 100644 --- a/src/commandline.cpp +++ b/src/commandline.cpp @@ -22,7 +22,7 @@ #include #include #include "commandline.h" - +#include //ADDED for @FILELIST FUNCTIONALY #ifdef _MSC_VER #ifdef _DEBUG @@ -139,7 +139,11 @@ void CommandLine::usage(void) " -l : Limit size of recovery files (don't use both -u and -l)\n" " -n : Number of recovery files (max 31) (don't use both -n and -l)\n" " -R : Recurse into subdirectories\n" - " (Be aware of wildcard shell expansion)\n" + " (Be aware of wildcard shell expansion)\n" + " @ : Process a listing of files specified in a text file \n" + " (eg. @filelist.txt) \n" + + "\n"; std::cout << "Example:\n" @@ -289,10 +293,11 @@ bool CommandLine::ReadArgs(int argc, const char * const *argv) { if (argv[0][0]) { - if (options && argv[0][0] != '-') + //MODIFIED FOR @FILELIST FUNCTIONALITY + if (options && argv[0][0] != '-' && argv[0][0] != '@') options = false; - - if (options) + //MODIFIED FOR @FILELIST FUNCTIONALITY + if (options && argv[0][0] == '-') { switch (argv[0][1]) { @@ -854,7 +859,50 @@ bool CommandLine::ReadArgs(int argc, const char * const *argv) return false; } } - } + } +//START SECTION FOR ADDING @FILELIST FUNCTIONALITY + else if (argv[0][0] == '@') // Handle list files + { + // 1. Check if the '@' is followed by a filename + if (argv[0][1] == '\0') + { + std::cerr << "No filename specified after '@' symbol." << std::endl; + return false; + } + + std::ifstream listfile(&argv[0][1]); + if (!listfile.is_open()) + { + std::cerr << "Could not open list file: " << &argv[0][1] << std::endl; + return false; + } + + std::string line; + while (std::getline(listfile, line)) + { + // 2. Trim whitespace or skip whitespace-only lines + // This finds the first non-whitespace character + size_t first = line.find_first_not_of(" \t\r\n"); + if (first == std::string::npos) + continue; // Line is empty or only whitespace + + // 3. Removed the 'parfilename.length() == 0' block. + // All files in the list are now treated as source files. + + std::string lpath, lname; + DiskFile::SplitFilename(line, lpath, lname); + std::unique_ptr> filenames(DiskFile::FindFiles(lpath, lname, recursive)); + + if (filenames) + { + for (auto const& fn : *filenames) + { + rawfilenames.push_back(DiskFile::GetCanonicalPathname(fn)); + } + } + } + } //END SECTION FOR ADDING @filelist FUNCTIONALITY + else if (parfilename.length() == 0) { std::string filename = argv[0]; @@ -884,7 +932,7 @@ bool CommandLine::ReadArgs(int argc, const char * const *argv) ++fn; } - // delete filenames; Taken care of by unique_ptr<> + // delete filenames; Taken care of by unique_ptr<> } } From fd3224fbbd69d3e79ba7c06e8a3a1c77b86c6c7a Mon Sep 17 00:00:00 2001 From: BlackEagle Date: Mon, 20 Apr 2026 17:59:00 +0200 Subject: [PATCH 2/3] commandline, use the same pattern to search filenames in commandline filenames and filelist Signed-off-by: BlackEagle --- src/commandline.cpp | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/src/commandline.cpp b/src/commandline.cpp index f8d648be..c0271ab2 100644 --- a/src/commandline.cpp +++ b/src/commandline.cpp @@ -139,11 +139,9 @@ void CommandLine::usage(void) " -l : Limit size of recovery files (don't use both -u and -l)\n" " -n : Number of recovery files (max 31) (don't use both -n and -l)\n" " -R : Recurse into subdirectories\n" - " (Be aware of wildcard shell expansion)\n" - " @ : Process a listing of files specified in a text file \n" - " (eg. @filelist.txt) \n" - - + " (Be aware of wildcard shell expansion)\n" + " @ : Process a listing of files specified in a text file \n" + " (eg. @filelist.txt) \n" "\n"; std::cout << "Example:\n" @@ -859,7 +857,7 @@ bool CommandLine::ReadArgs(int argc, const char * const *argv) return false; } } - } + } //START SECTION FOR ADDING @FILELIST FUNCTIONALITY else if (argv[0][0] == '@') // Handle list files { @@ -883,16 +881,18 @@ bool CommandLine::ReadArgs(int argc, const char * const *argv) // 2. Trim whitespace or skip whitespace-only lines // This finds the first non-whitespace character size_t first = line.find_first_not_of(" \t\r\n"); - if (first == std::string::npos) + if (first == std::string::npos) continue; // Line is empty or only whitespace // 3. Removed the 'parfilename.length() == 0' block. // All files in the list are now treated as source files. - + std::string lpath, lname; DiskFile::SplitFilename(line, lpath, lname); - std::unique_ptr> filenames(DiskFile::FindFiles(lpath, lname, recursive)); - + std::unique_ptr< std::list > filenames( + DiskFile::FindFiles(lpath, lname, recursive) + ); + if (filenames) { for (auto const& fn : *filenames) @@ -902,7 +902,7 @@ bool CommandLine::ReadArgs(int argc, const char * const *argv) } } } //END SECTION FOR ADDING @filelist FUNCTIONALITY - + else if (parfilename.length() == 0) { std::string filename = argv[0]; @@ -919,20 +919,17 @@ bool CommandLine::ReadArgs(int argc, const char * const *argv) std::string path; std::string name; DiskFile::SplitFilename(argv[0], path, name); - std::unique_ptr< std::list > filenames( - DiskFile::FindFiles(path, name, recursive) - ); + std::unique_ptr< std::list > filenames( + DiskFile::FindFiles(path, name, recursive) + ); - std::list::iterator fn = filenames->begin(); - while (fn != filenames->end()) + if (filenames) { - // Convert filename from command line into a full path + filename - std::string filename = DiskFile::GetCanonicalPathname(*fn); - rawfilenames.push_back(filename); - ++fn; + for (auto const& fn : *filenames) + { + rawfilenames.push_back(DiskFile::GetCanonicalPathname(fn)); + } } - - // delete filenames; Taken care of by unique_ptr<> } } From 58bf8a90fcef1e63255c172f953cead1841e3d6f Mon Sep 17 00:00:00 2001 From: BlackEagle Date: Mon, 20 Apr 2026 19:15:13 +0200 Subject: [PATCH 3/3] added tests for filelist Signed-off-by: BlackEagle --- Makefile.am | 16 ++++++++ tests/flatdata-filelist.txt | 10 +++++ tests/subdirdata-filelist.txt | 10 +++++ tests/subdirdata-folder-filelist.txt | 6 +++ tests/subdirdata-partial-filelist.txt | 6 +++ tests/test36 | 54 +++++++++++++++++++++++++++ tests/test36.ps1 | 37 ++++++++++++++++++ tests/test37 | 53 ++++++++++++++++++++++++++ tests/test37.ps1 | 37 ++++++++++++++++++ tests/test38 | 53 ++++++++++++++++++++++++++ tests/test38.ps1 | 37 ++++++++++++++++++ tests/test39 | 53 ++++++++++++++++++++++++++ tests/test39.ps1 | 37 ++++++++++++++++++ 13 files changed, 409 insertions(+) create mode 100644 tests/flatdata-filelist.txt create mode 100644 tests/subdirdata-filelist.txt create mode 100644 tests/subdirdata-folder-filelist.txt create mode 100644 tests/subdirdata-partial-filelist.txt create mode 100755 tests/test36 create mode 100644 tests/test36.ps1 create mode 100755 tests/test37 create mode 100644 tests/test37.ps1 create mode 100755 tests/test38 create mode 100644 tests/test38.ps1 create mode 100755 tests/test39 create mode 100644 tests/test39.ps1 diff --git a/Makefile.am b/Makefile.am index 370bd138..f5cebfcd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -77,6 +77,10 @@ EXTRA_DIST = PORTING ROADMAP \ tests/bug44.tar.gz \ tests/bug128-parfiles.tar.gz \ tests/bug190.tar.gz \ + tests/flatdata-filelist.txt \ + tests/subdirdata-filelist.txt \ + tests/subdirdata-partial-filelist.txt \ + tests/subdirdata-folder-filelist.txt \ tests/testfuncs.ps1 \ tests/build_unit_tests.ps1 \ tests/run_tests.ps1 \ @@ -152,6 +156,14 @@ EXTRA_DIST = PORTING ROADMAP \ tests/test34.ps1 \ tests/test35 \ tests/test35.ps1 \ + tests/test36 \ + tests/test36.ps1 \ + tests/test37 \ + tests/test37.ps1 \ + tests/test38 \ + tests/test38.ps1 \ + tests/test39 \ + tests/test39.ps1 \ tests/unit_tests \ tests/unit_tests.ps1 @@ -227,6 +239,10 @@ TESTS = tests/test1 \ tests/test33 \ tests/test34 \ tests/test35 \ + tests/test36 \ + tests/test37 \ + tests/test38 \ + tests/test39 \ tests/utf8_test \ tests/unit_tests diff --git a/tests/flatdata-filelist.txt b/tests/flatdata-filelist.txt new file mode 100644 index 00000000..fdf07014 --- /dev/null +++ b/tests/flatdata-filelist.txt @@ -0,0 +1,10 @@ +test-0.data +test-1.data +test-2.data +test-3.data +test-4.data +test-5.data +test-6.data +test-7.data +test-8.data +test-9.data diff --git a/tests/subdirdata-filelist.txt b/tests/subdirdata-filelist.txt new file mode 100644 index 00000000..f2481dd2 --- /dev/null +++ b/tests/subdirdata-filelist.txt @@ -0,0 +1,10 @@ +subdir1/test-0.data +subdir2/test-1.data +subdir1/test-2.data +subdir2/test-3.data +subdir1/test-4.data +subdir2/test-5.data +subdir1/test-6.data +subdir2/test-7.data +subdir1/test-8.data +subdir2/test-9.data diff --git a/tests/subdirdata-folder-filelist.txt b/tests/subdirdata-folder-filelist.txt new file mode 100644 index 00000000..89c8922d --- /dev/null +++ b/tests/subdirdata-folder-filelist.txt @@ -0,0 +1,6 @@ +subdir1 +subdir2/test-1.data +subdir2/test-3.data +subdir2/test-5.data +subdir2/test-7.data +subdir2/test-9.data diff --git a/tests/subdirdata-partial-filelist.txt b/tests/subdirdata-partial-filelist.txt new file mode 100644 index 00000000..f04966ee --- /dev/null +++ b/tests/subdirdata-partial-filelist.txt @@ -0,0 +1,6 @@ +subdir1/test-0.data +subdir2/test-1.data +subdir1/test-2.data +subdir2/test-3.data +subdir1/test-4.data +subdir2/test-5.data diff --git a/tests/test36 b/tests/test36 new file mode 100755 index 00000000..fff04b8a --- /dev/null +++ b/tests/test36 @@ -0,0 +1,54 @@ +#!/bin/sh + +execdir="$PWD" + +# valgrind tests memory usage. +# wine allow for windows testing on linux +if [ -n "${PARVALGRINDOPTS+set}" ] +then + PARBINARY="valgrind $PARVALGRINDOPTS $execdir/par2" +elif [ "`which wine`" != "" ] && [ -f "$execdir/par2.exe" ] +then + PARBINARY="wine $execdir/par2.exe" +else + PARBINARY="$execdir/par2" +fi + + +if [ -z "$srcdir" ] || [ "." = "$srcdir" ]; then + srcdir="$PWD" + TESTDATA="$srcdir/tests" +else + srcdir="$PWD/$srcdir" + TESTDATA="$srcdir/tests" +fi + +TESTROOT="$PWD" + +testname=$(basename $0) +rm -f "$testname.log" +rm -rf "run$testname" + +mkdir "run$testname" && cd "run$testname" || { echo "ERROR: Could not change to test directory" ; exit 1; } >&2 + +tar -xzf "$TESTDATA/flatdata.tar.gz" || { echo "ERROR: Could not extract data test files" ; exit 1; } >&2 + +banner="Testing flat data par2 creation with filelist form file" +dashes=`echo "$banner" | sed s/./-/g` + +echo $dashes +echo $banner +echo $dashes + +# get @flatdata-filelist.txt +cp "$TESTDATA/flatdata-filelist.txt" ./ + +$PARBINARY c recovery.par2 @flatdata-filelist.txt || { echo "ERROR: failed to create parchive from filelist" ; exit 1; } >&2 +$PARBINARY v recovery.par2 || { echo "ERROR: failed to verify parchive created from filelist" ; exit 1; } >&2 + +echo "Sucessfully created and verified par2 recovery with filelist from file" + +cd "$TESTROOT" +rm -rf "run$testname" + +exit 0 diff --git a/tests/test36.ps1 b/tests/test36.ps1 new file mode 100644 index 00000000..244553bb --- /dev/null +++ b/tests/test36.ps1 @@ -0,0 +1,37 @@ +#!/usr/bin/env pwsh +# Test 34: Rename-only mode skips damaged files + +$ErrorActionPreference = "Stop" + +# Source common test functions +. (Join-Path $PSScriptRoot "testfuncs.ps1") + +$testname = [System.IO.Path]::GetFileNameWithoutExtension($MyInvocation.MyCommand.Name) + +try { + Initialize-Test -TestName $testname + + Expand-TarGz -Archive (Join-Path $TESTDATA "flatdata.tar.gz") -Destination "." + Copy-Item (Join-Path $TESTDATA "flatdata-filelist.txt") "." + + Write-Banner "Testing flat data par2 creation with filelist from file" + + $exitCode = Invoke-Par2 -Arguments @("c", "recovery.par2", "@flatdata-filelist.txt") + if ($exitCode -ne 0) { + Exit-TestWithError "failed to create parchive from filelist" + } + + $exitCode = Invoke-Par2 -Arguments @("r", "recovery.par2") + if ($exitCode -ne 0) { + Exit-TestWithError "failed to verify parchive created from filelist" + } + + Write-Host "Sucessfully created and verified par2 recovery with filelist from file" + Complete-Test + exit 0 +} +catch { + Write-Host "ERROR: $_" -ForegroundColor Red + Complete-Test + exit 1 +} diff --git a/tests/test37 b/tests/test37 new file mode 100755 index 00000000..ae2890da --- /dev/null +++ b/tests/test37 @@ -0,0 +1,53 @@ +#!/bin/sh + +execdir="$PWD" + +# valgrind tests memory usage. +# wine allow for windows testing on linux +if [ -n "${PARVALGRINDOPTS+set}" ] +then + PARBINARY="valgrind $PARVALGRINDOPTS $execdir/par2" +elif [ "`which wine`" != "" ] && [ -f "$execdir/par2.exe" ] +then + PARBINARY="wine $execdir/par2.exe" +else + PARBINARY="$execdir/par2" +fi + + +if [ -z "$srcdir" ] || [ "." = "$srcdir" ]; then + srcdir="$PWD" + TESTDATA="$srcdir/tests" +else + srcdir="$PWD/$srcdir" + TESTDATA="$srcdir/tests" +fi + +TESTROOT="$PWD" + +testname=$(basename $0) +rm -f "$testname.log" +rm -rf "run$testname" + +mkdir "run$testname" && cd "run$testname" || { echo "ERROR: Could not change to test directory" ; exit 1; } >&2 + +tar -xzf "$TESTDATA/subdirdata.tar.gz" || { echo "ERROR: Could not extract data test files" ; exit 1; } >&2 + +banner="Testing subdir data par2 creation with filelist form file" +dashes=`echo "$banner" | sed s/./-/g` + +echo $dashes +echo $banner +echo $dashes + +cp "$TESTDATA/subdirdata-filelist.txt" ./ + +$PARBINARY c recovery.par2 @subdirdata-filelist.txt || { echo "ERROR: failed to create parchive from filelist" ; exit 1; } >&2 +$PARBINARY v recovery.par2 || { echo "ERROR: failed to verify parchive created from filelist" ; exit 1; } >&2 + +echo "Sucessfully created and verified par2 recovery with filelist from file" + +cd "$TESTROOT" +rm -rf "run$testname" + +exit 0 diff --git a/tests/test37.ps1 b/tests/test37.ps1 new file mode 100644 index 00000000..1fe06c63 --- /dev/null +++ b/tests/test37.ps1 @@ -0,0 +1,37 @@ +#!/usr/bin/env pwsh +# Test 34: Rename-only mode skips damaged files + +$ErrorActionPreference = "Stop" + +# Source common test functions +. (Join-Path $PSScriptRoot "testfuncs.ps1") + +$testname = [System.IO.Path]::GetFileNameWithoutExtension($MyInvocation.MyCommand.Name) + +try { + Initialize-Test -TestName $testname + + Expand-TarGz -Archive (Join-Path $TESTDATA "subdirdata.tar.gz") -Destination "." + Copy-Item (Join-Path $TESTDATA "subdirdata-filelist.txt") "." + + Write-Banner "Testing subdir data par2 creation with filelist form file" + + $exitCode = Invoke-Par2 -Arguments @("c", "recovery.par2", "@subdirdata-filelist.txt") + if ($exitCode -ne 0) { + Exit-TestWithError "failed to create parchive from filelist" + } + + $exitCode = Invoke-Par2 -Arguments @("r", "recovery.par2") + if ($exitCode -ne 0) { + Exit-TestWithError "failed to verify parchive created from filelist" + } + + Write-Host "Sucessfully created and verified par2 recovery with filelist from file" + Complete-Test + exit 0 +} +catch { + Write-Host "ERROR: $_" -ForegroundColor Red + Complete-Test + exit 1 +} diff --git a/tests/test38 b/tests/test38 new file mode 100755 index 00000000..98494cdd --- /dev/null +++ b/tests/test38 @@ -0,0 +1,53 @@ +#!/bin/sh + +execdir="$PWD" + +# valgrind tests memory usage. +# wine allow for windows testing on linux +if [ -n "${PARVALGRINDOPTS+set}" ] +then + PARBINARY="valgrind $PARVALGRINDOPTS $execdir/par2" +elif [ "`which wine`" != "" ] && [ -f "$execdir/par2.exe" ] +then + PARBINARY="wine $execdir/par2.exe" +else + PARBINARY="$execdir/par2" +fi + + +if [ -z "$srcdir" ] || [ "." = "$srcdir" ]; then + srcdir="$PWD" + TESTDATA="$srcdir/tests" +else + srcdir="$PWD/$srcdir" + TESTDATA="$srcdir/tests" +fi + +TESTROOT="$PWD" + +testname=$(basename $0) +rm -f "$testname.log" +rm -rf "run$testname" + +mkdir "run$testname" && cd "run$testname" || { echo "ERROR: Could not change to test directory" ; exit 1; } >&2 + +tar -xzf "$TESTDATA/subdirdata.tar.gz" || { echo "ERROR: Could not extract data test files" ; exit 1; } >&2 + +banner="Testing subdir data par2 creation with mixed files and filelist" +dashes=`echo "$banner" | sed s/./-/g` + +echo $dashes +echo $banner +echo $dashes + +cp "$TESTDATA/subdirdata-partial-filelist.txt" ./ + +$PARBINARY c recovery.par2 subdir1/test-6.data subdir2/test-7.data @subdirdata-partial-filelist.txt subdir1/test-8.data subdir2/test-9.data || { echo "ERROR: failed to create parchive from filelist" ; exit 1; } >&2 +$PARBINARY v recovery.par2 || { echo "ERROR: failed to verify parchive created from filelist" ; exit 1; } >&2 + +echo "Sucessfully created and verified par2 recovery with filelist from file" + +cd "$TESTROOT" +rm -rf "run$testname" + +exit 0 diff --git a/tests/test38.ps1 b/tests/test38.ps1 new file mode 100644 index 00000000..623a2ba1 --- /dev/null +++ b/tests/test38.ps1 @@ -0,0 +1,37 @@ +#!/usr/bin/env pwsh +# Test 34: Rename-only mode skips damaged files + +$ErrorActionPreference = "Stop" + +# Source common test functions +. (Join-Path $PSScriptRoot "testfuncs.ps1") + +$testname = [System.IO.Path]::GetFileNameWithoutExtension($MyInvocation.MyCommand.Name) + +try { + Initialize-Test -TestName $testname + + Expand-TarGz -Archive (Join-Path $TESTDATA "subdirdata.tar.gz") -Destination "." + Copy-Item (Join-Path $TESTDATA "subdirdata-partial-filelist.txt") "." + + Write-Banner "Testing subdir data par2 creation with filelist form file" + + $exitCode = Invoke-Par2 -Arguments @("c", "recovery.par2", "subdir1\test-6.data", "subdir2\test-7.data", "@subdirdata-partial-filelist.txt", "subdir1/test-8.data", "subdir2/test-9.data") + if ($exitCode -ne 0) { + Exit-TestWithError "failed to create parchive from filelist" + } + + $exitCode = Invoke-Par2 -Arguments @("r", "recovery.par2") + if ($exitCode -ne 0) { + Exit-TestWithError "failed to verify parchive created from filelist" + } + + Write-Host "Sucessfully created and verified par2 recovery with filelist from file" + Complete-Test + exit 0 +} +catch { + Write-Host "ERROR: $_" -ForegroundColor Red + Complete-Test + exit 1 +} diff --git a/tests/test39 b/tests/test39 new file mode 100755 index 00000000..4d761ec7 --- /dev/null +++ b/tests/test39 @@ -0,0 +1,53 @@ +#!/bin/sh + +execdir="$PWD" + +# valgrind tests memory usage. +# wine allow for windows testing on linux +if [ -n "${PARVALGRINDOPTS+set}" ] +then + PARBINARY="valgrind $PARVALGRINDOPTS $execdir/par2" +elif [ "`which wine`" != "" ] && [ -f "$execdir/par2.exe" ] +then + PARBINARY="wine $execdir/par2.exe" +else + PARBINARY="$execdir/par2" +fi + + +if [ -z "$srcdir" ] || [ "." = "$srcdir" ]; then + srcdir="$PWD" + TESTDATA="$srcdir/tests" +else + srcdir="$PWD/$srcdir" + TESTDATA="$srcdir/tests" +fi + +TESTROOT="$PWD" + +testname=$(basename $0) +rm -f "$testname.log" +rm -rf "run$testname" + +mkdir "run$testname" && cd "run$testname" || { echo "ERROR: Could not change to test directory" ; exit 1; } >&2 + +tar -xzf "$TESTDATA/subdirdata.tar.gz" || { echo "ERROR: Could not extract data test files" ; exit 1; } >&2 + +banner="Testing recursive subdir data par2 creation with mixed filelist" +dashes=`echo "$banner" | sed s/./-/g` + +echo $dashes +echo $banner +echo $dashes + +cp "$TESTDATA/subdirdata-folder-filelist.txt" ./ + +$PARBINARY c -R recovery.par2 @subdirdata-folder-filelist.txt || { echo "ERROR: failed to create parchive from filelist" ; exit 1; } >&2 +$PARBINARY v recovery.par2 || { echo "ERROR: failed to verify parchive created from filelist" ; exit 1; } >&2 + +echo "Sucessfully created and verified par2 recovery with filelist from file" + +cd "$TESTROOT" +rm -rf "run$testname" + +exit 0 diff --git a/tests/test39.ps1 b/tests/test39.ps1 new file mode 100644 index 00000000..27e10db9 --- /dev/null +++ b/tests/test39.ps1 @@ -0,0 +1,37 @@ +#!/usr/bin/env pwsh +# Test 34: Rename-only mode skips damaged files + +$ErrorActionPreference = "Stop" + +# Source common test functions +. (Join-Path $PSScriptRoot "testfuncs.ps1") + +$testname = [System.IO.Path]::GetFileNameWithoutExtension($MyInvocation.MyCommand.Name) + +try { + Initialize-Test -TestName $testname + + Expand-TarGz -Archive (Join-Path $TESTDATA "subdirdata.tar.gz") -Destination "." + Copy-Item (Join-Path $TESTDATA "subdirdata-folder-filelist.txt") "." + + Write-Banner "Testing recursive subdir data par2 creation with mixed filelist" + + $exitCode = Invoke-Par2 -Arguments @("c", "-R", "recovery.par2", "@subdirdata-folder-filelist.txt") + if ($exitCode -ne 0) { + Exit-TestWithError "failed to create parchive from filelist" + } + + $exitCode = Invoke-Par2 -Arguments @("r", "recovery.par2") + if ($exitCode -ne 0) { + Exit-TestWithError "failed to verify parchive created from filelist" + } + + Write-Host "Sucessfully created and verified par2 recovery with filelist from file" + Complete-Test + exit 0 +} +catch { + Write-Host "ERROR: $_" -ForegroundColor Red + Complete-Test + exit 1 +}