Skip to content

Commit

Permalink
Missed one
Browse files Browse the repository at this point in the history
  • Loading branch information
parg committed Sep 26, 2023
1 parent 9b06af7 commit ca033fd
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
26 changes: 24 additions & 2 deletions core/src/com/biglybt/core/util/FileUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -3637,10 +3637,22 @@ public static long getUsableSpace(File f)
FileOpWithTimeout<T> fo,
IOException def_error )

throws IOException
{
return( runFileOpWithTimeoutEx( file, fo, def_error, -1 ));
}

private static <T> T
runFileOpWithTimeoutEx(
File file,
FileOpWithTimeout<T> fo,
IOException def_error,
long strict_timeout )

throws IOException
{
try{
return( runFileOpWithTimeoutEx( file, fo, null, def_error, -1 ));
return( runFileOpWithTimeoutEx( file, fo, null, def_error, strict_timeout ));

}catch( IOException e ){

Expand Down Expand Up @@ -3950,11 +3962,21 @@ public static long getUsableSpace(File f)
getCanonicalPathWithTimeout(
File file )

throws IOException
{
return( getCanonicalPathWithTimeout( file, -1 ));
}

public static String
getCanonicalPathWithTimeout(
File file,
long strict_timeout )

throws IOException
{
return(runFileOpWithTimeoutEx(file,()->{
return( file.getCanonicalPath());
}, new IOException( "File system not responding/slow" )));
}, new IOException( "File system not responding/slow" ), strict_timeout ));
}

private static volatile File[] last_roots = {};
Expand Down
9 changes: 9 additions & 0 deletions uis/src/com/biglybt/ui/swt/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -7082,6 +7082,15 @@ public void handleEvent(Event e) {
return( FileUtil.lengthWithTimeout( file, 250 ));
}

public static String
getCanonicalPathWithTimeout(
File file )

throws IOException
{
return( FileUtil.getCanonicalPathWithTimeout( file, 250 ));
}

public static File[]
listFileRootsWithTimeout()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import com.biglybt.pif.ui.tables.TableCellRefreshListener;
import com.biglybt.pif.ui.tables.TableColumnInfo;
import com.biglybt.pif.ui.tables.TableManager;
import com.biglybt.ui.swt.Utils;
import com.biglybt.ui.swt.views.FilesView;
import com.biglybt.ui.swt.views.table.CoreTableColumnSWT;

Expand Down Expand Up @@ -136,7 +137,7 @@ protected static String determinePath(DiskManagerFileInfo fileInfo, boolean _sho

if ( parent != null ){
try {
path = FileUtil.getCanonicalPathWithTimeout( parent );
path = Utils.getCanonicalPathWithTimeout( parent );
}
catch( IOException e ) {
path = file.getParentFile().getAbsolutePath();
Expand Down

0 comments on commit ca033fd

Please sign in to comment.