Browse code

#0000032 use os agnostic directory delimiters

fix newlines in list mode

René Wagner authored on 01.10.2019 21:47:28
Showing 3 changed files

... ...
@@ -8,9 +8,10 @@ The following perl modules are required for running the scripts.
8 8
 
9 9
 - Cwd
10 10
 - File::Basename
11
+- File::Copy
11 12
 - File::Find::Rule
12 13
 - File::Find
13
-- File::Copy
14
+- File::Spec::Functions
14 15
 - Switch
15 16
 
16 17
 ## description
... ...
@@ -55,13 +55,14 @@ sub main
55 55
 			{
56 56
 				if ( unlink $file )
57 57
 				{
58
-					say 'deleted.'
58
+					print 'deleted.'
59 59
 				}
60 60
 				else
61 61
 				{
62
-					say " deletion failed: $!";
62
+					print " deletion failed: $!";
63 63
 				} 
64 64
 			}
65
+			say '';
65 66
 		}
66 67
 	}
67 68
 	
... ...
@@ -10,9 +10,10 @@ use Cwd;
10 10
 use File::Basename;
11 11
 use File::Find::Rule;
12 12
 use File::Find;
13
+use File::Spec::Functions;
13 14
 use Switch;
14 15
 
15
-my $VERSION = '0.2';
16
+my $VERSION = '0.3';
16 17
 my $PROGRAM = 'Orphaned Sidecar Cleaner';
17 18
 
18 19
 # parse commandline args
... ...
@@ -56,13 +57,14 @@ sub main
56 57
 			{
57 58
 				if ( unlink $file )
58 59
 				{
59
-					say 'deleted.';
60
+					print 'deleted.';
60 61
 				}
61 62
 				else
62 63
 				{
63
-					say " deletion failed: $!";
64
+					print " deletion failed: $!";
64 65
 				} 
65 66
 			}
67
+			say '';
66 68
 		}
67 69
 	}
68 70
 	
... ...
@@ -76,7 +78,7 @@ sub exists_raw_filename
76 78
 	my ( $filename, $dirs ) = fileparse($original_file);
77 79
 	# Silkypix Sidecar files reside in a "SILKYPIX_DS" folder, so we need to search in the parent folder
78 80
 	$filename =~ s/\.\d+\.sp.$//g;
79
-	if ( -f dirname($dirs) .'/'. $filename )
81
+	if ( -f catfile(dirname($dirs), $filename) )
80 82
 	{
81 83
 		return 1;
82 84
 	}