1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-01-02 11:36:22 +01:00

Handle deleting symlinks differently on Windows

This commit is contained in:
Spencer McIntyre 2024-11-06 17:25:32 -05:00
parent 64631d276b
commit af89b273e6

View File

@ -7,7 +7,11 @@ import java.nio.file.Files;
public class stdapi_fs_delete_dir_V1_7 extends stdapi_fs_delete_dir {
@Override
protected boolean deleteSymlink(File file) throws IOException {
String osName = System.getProperty("os.name");
if (osName != null && osName.toLowerCase().contains("windows")) {
Files.delete(file.toPath());
return true;
}
return file.delete();
}
}