File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -347,7 +347,16 @@ void main(List<String> arguments) async {
347347 final c = args['copy' ]
348348 ? await m.file.copy (freeFile.path)
349349 : await m.file.rename (freeFile.path);
350- await c.setLastModified (m.dateTaken ?? DateTime .now ());
350+ var time = m.dateTaken ?? DateTime .now ();
351+ if (Platform .isWindows && time.isBefore (DateTime (1970 ))) {
352+ print ('WARNING: ${m .file .path } has date $time , which is before 1970 '
353+ '(not supported on Windows) - will be set to 1970-01-01' );
354+ time = DateTime (1970 );
355+ }
356+ await c.setLastModified (time);
357+ // on windows, there is also file creation - but it's not supported by dart
358+ // i tried this, and kinda works, but is extra slow :(
359+ // await Process.run('Powershell.exe', ['-command', '(Get-Item "${c.path}").CreationTime=("${time.toLocal().toIso8601String()}")']);
351360 barCopy.increment ();
352361 }
353362 print ('' );
You can’t perform that action at this time.
0 commit comments