File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
src/main/java/org/codehaus/plexus/util/io Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 22
22
import java .nio .Buffer ;
23
23
import java .nio .ByteBuffer ;
24
24
import java .nio .channels .FileChannel ;
25
+ import java .nio .file .Files ;
25
26
import java .nio .file .Path ;
26
27
import java .nio .file .StandardOpenOption ;
28
+ import java .nio .file .attribute .FileTime ;
29
+ import java .time .Instant ;
27
30
import java .util .Objects ;
28
31
29
32
/**
@@ -154,7 +157,12 @@ public void close() throws IOException
154
157
long position = channel .position ();
155
158
if ( position != channel .size () )
156
159
{
157
- modified = true ;
160
+ if ( !modified )
161
+ {
162
+ FileTime now = FileTime .from ( Instant .now () );
163
+ Files .setLastModifiedTime ( path , now );
164
+ modified = true ;
165
+ }
158
166
channel .truncate ( position );
159
167
}
160
168
channel .close ();
You can’t perform that action at this time.
0 commit comments