Change the method of how the filepath are generated
To avoid having to update file or directory paths in 3 script locations (PHP Common, Shell Common and Python File path resolver) The .json file will references by all 3 systems, allowing them to generate paths from one central location. Files can be then moved around, the file updated and all 3 languages will up to date without any other work.
This commit is contained in:
@@ -17,6 +17,13 @@ function test()
|
||||
foreach (TEST_HOMES as $_test_home) {
|
||||
$home = $_test_home;
|
||||
|
||||
############################
|
||||
## Directory Path Tests
|
||||
############################
|
||||
$result = getDirectory('home');
|
||||
$expected = $_test_home;
|
||||
($result == $expected) ?: (print "failed directory 'home', expected: " . ($expected) . " got: " . ($result) . "\r\n");
|
||||
|
||||
# DIRECTORY TESTS
|
||||
$result = getDirectory('birdnet_pi');
|
||||
$expected = $_test_home . "/BirdNET-Pi";
|
||||
@@ -78,8 +85,9 @@ function test()
|
||||
$expected = $_test_home . "/BirdNET-Pi/homepage/static";
|
||||
($result == $expected) ?: (print "failed directory 'web_fonts', expected: " . ($expected) . " got: " . ($result) . "\r\n");
|
||||
|
||||
|
||||
############################
|
||||
# FILE PATH TESTS
|
||||
############################
|
||||
$result = getFilePath('analyzing_now.txt');
|
||||
$expected = $_test_home . "/BirdNET-Pi/analyzing_now.txt";
|
||||
($result == $expected) ?: (print "failed file path 'analyzing_now.txt', expected: " . ($expected) . " got: " . ($result) . "\r\n");
|
||||
@@ -128,6 +136,10 @@ function test()
|
||||
$expected = $_test_home . "/BirdNET-Pi/firstrun.ini";
|
||||
($result == $expected) ?: (print "failed file path 'firstrun.ini', expected: " . ($expected) . " got: " . ($result) . "\r\n");
|
||||
|
||||
$result = getFilePath('filepath_map.json');
|
||||
$expected = $_test_home . "/BirdNET-Pi/config/filepath_map.json";
|
||||
($result == $expected) ?: (print "failed file path 'filepath_map.json', expected: " . ($expected) . " got: " . ($result) . "\r\n");
|
||||
|
||||
$result = getFilePath('.gotty');
|
||||
$expected = $_test_home . "/.gotty";
|
||||
($result == $expected) ?: (print "failed file path '.gotty', expected: " . ($expected) . " got: " . ($result) . "\r\n");
|
||||
|
||||
Reference in New Issue
Block a user