Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ else if( foundDirs > 1 )
}
else
{
throw new IOException( "Not a directory" );
throw new IOException( "/" + path + ": Not a directory" );
}
}

Expand All @@ -109,7 +109,7 @@ public long getSize( @Nonnull String path ) throws IOException
return part.getSize( path );
}
}
throw new IOException( "No such file" );
throw new IOException( "/" + path + ": No such file" );
}

@Nonnull
Expand All @@ -124,6 +124,6 @@ public InputStream openForRead( @Nonnull String path ) throws IOException
return part.openForRead( path );
}
}
throw new IOException( "No such file" );
throw new IOException( "/" + path + ": No such file" );
}
}
26 changes: 13 additions & 13 deletions src/main/java/dan200/computercraft/core/filesystem/FileMount.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public void list( @Nonnull String path, @Nonnull List<String> contents ) throws
{
if( path.length() != 0 )
{
throw new IOException( "Not a directory" );
throw new IOException( "/" + path + ": Not a directory" );
}
}
else
Expand All @@ -148,7 +148,7 @@ public void list( @Nonnull String path, @Nonnull List<String> contents ) throws
}
else
{
throw new IOException( "Not a directory" );
throw new IOException( "/" + path + ": Not a directory" );
}
}
}
Expand Down Expand Up @@ -178,7 +178,7 @@ public long getSize( @Nonnull String path ) throws IOException
}
}
}
throw new IOException( "No such file" );
throw new IOException( "/" + path + ": No such file" );
}

@Nonnull
Expand All @@ -193,7 +193,7 @@ public InputStream openForRead( @Nonnull String path ) throws IOException
return new FileInputStream( file );
}
}
throw new IOException( "No such file" );
throw new IOException( "/" + path + ": No such file" );
}

// IWritableMount implementation
Expand All @@ -207,7 +207,7 @@ public void makeDirectory( @Nonnull String path ) throws IOException
{
if( !file.isDirectory() )
{
throw new IOException( "File exists" );
throw new IOException( "/" + path + ": File exists" );
}
}
else
Expand All @@ -222,7 +222,7 @@ public void makeDirectory( @Nonnull String path ) throws IOException

if( getRemainingSpace() < dirsToCreate * MINIMUM_FILE_SIZE )
{
throw new IOException( "Out of space" );
throw new IOException( "/" + path + ": Out of space" );
}

boolean success = file.mkdirs();
Expand All @@ -232,7 +232,7 @@ public void makeDirectory( @Nonnull String path ) throws IOException
}
else
{
throw new IOException( "Access denied" );
throw new IOException( "/" + path + ": Access denied" );
}
}
}
Expand All @@ -242,7 +242,7 @@ public void delete( @Nonnull String path ) throws IOException
{
if( path.length() == 0 )
{
throw new IOException( "Access denied" );
throw new IOException( "/" + path + ": Access denied" );
}

if( created() )
Expand Down Expand Up @@ -288,15 +288,15 @@ public OutputStream openForWrite( @Nonnull String path ) throws IOException
File file = getRealPath( path );
if( file.exists() && file.isDirectory() )
{
throw new IOException( "Cannot write to directory" );
throw new IOException( "/" + path + ": Cannot write to directory" );
}
else
{
if( !file.exists() )
{
if( getRemainingSpace() < MINIMUM_FILE_SIZE )
{
throw new IOException( "Out of space" );
throw new IOException( "/" + path + ": Out of space" );
}
else
{
Expand All @@ -321,11 +321,11 @@ public OutputStream openForAppend( @Nonnull String path ) throws IOException
File file = getRealPath( path );
if( !file.exists() )
{
throw new IOException( "No such file" );
throw new IOException( "/" + path + ": No such file" );
}
else if( file.isDirectory() )
{
throw new IOException( "Cannot write to directory" );
throw new IOException( "/" + path + ": Cannot write to directory" );
}
else
{
Expand All @@ -334,7 +334,7 @@ else if( file.isDirectory() )
}
else
{
throw new IOException( "No such file" );
throw new IOException( "/" + path + ": No such file" );
}
}

Expand Down
30 changes: 15 additions & 15 deletions src/main/java/dan200/computercraft/core/filesystem/FileSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void list( String path, List<String> contents ) throws FileSystemExceptio
}
else
{
throw new FileSystemException( "Not a directory" );
throw new FileSystemException( "/" + path + ": Not a directory" );
}
}
catch( IOException e )
Expand All @@ -137,7 +137,7 @@ public long getSize( String path ) throws FileSystemException
}
else
{
throw new FileSystemException( "No such file" );
throw new FileSystemException( "/" + path + ": No such file" );
}
}
catch( IOException e )
Expand All @@ -157,7 +157,7 @@ public InputStream openForRead( String path ) throws FileSystemException
}
else
{
throw new FileSystemException( "No such file" );
throw new FileSystemException( "/" + path + ": No such file" );
}
}
catch( IOException e )
Expand All @@ -172,7 +172,7 @@ public void makeDirectory( String path ) throws FileSystemException
{
if( m_writableMount == null )
{
throw new FileSystemException( "Access denied" );
throw new FileSystemException( "/" + path + ": Access denied" );
}
try
{
Expand All @@ -181,7 +181,7 @@ public void makeDirectory( String path ) throws FileSystemException
{
if( !m_mount.isDirectory( path ) )
{
throw new FileSystemException( "File exists" );
throw new FileSystemException( "/" + path + ": File exists" );
}
}
else
Expand All @@ -199,7 +199,7 @@ public void delete( String path ) throws FileSystemException
{
if( m_writableMount == null )
{
throw new FileSystemException( "Access denied" );
throw new FileSystemException( "/" + path + ": Access denied" );
}
try
{
Expand All @@ -219,14 +219,14 @@ public OutputStream openForWrite( String path ) throws FileSystemException
{
if( m_writableMount == null )
{
throw new FileSystemException( "Access denied" );
throw new FileSystemException( "/" + path + ": Access denied" );
}
try
{
path = toLocal( path );
if( m_mount.exists( path ) && m_mount.isDirectory( path ) )
{
throw new FileSystemException( "Cannot write to directory" );
throw new FileSystemException( "/" + path + ": Cannot write to directory" );
}
else
{
Expand All @@ -251,7 +251,7 @@ public OutputStream openForAppend( String path ) throws FileSystemException
{
if( m_writableMount == null )
{
throw new FileSystemException( "Access denied" );
throw new FileSystemException( "/" + path + ": Access denied" );
}
try
{
Expand All @@ -270,7 +270,7 @@ public OutputStream openForAppend( String path ) throws FileSystemException
}
else if( m_mount.isDirectory( path ) )
{
throw new FileSystemException( "Cannot write to directory" );
throw new FileSystemException( "/" + path + ": Cannot write to directory" );
}
else
{
Expand Down Expand Up @@ -557,16 +557,16 @@ public synchronized void copy( String sourcePath, String destPath ) throws FileS
sourcePath = sanitizePath( sourcePath );
destPath = sanitizePath( destPath );
if( isReadOnly( destPath ) ) {
throw new FileSystemException( "Access denied" );
throw new FileSystemException( "/" + destPath + ": Access denied" );
}
if( !exists( sourcePath ) ) {
throw new FileSystemException( "No such file" );
throw new FileSystemException( "/" + sourcePath + ": No such file" );
}
if( exists( destPath ) ) {
throw new FileSystemException( "File exists" );
throw new FileSystemException( "/" + destPath + ": File exists" );
}
if( contains( sourcePath, destPath ) ) {
throw new FileSystemException( "Can't copy a directory inside itself" );
throw new FileSystemException( "/" + sourcePath + ": Can't copy a directory inside itself" );
}
copyRecursive( sourcePath, getMount( sourcePath ), destPath, getMount( destPath ) );
}
Expand Down Expand Up @@ -730,7 +730,7 @@ private MountWrapper getMount( String path ) throws FileSystemException
}
if( match == null )
{
throw new FileSystemException( "Invalid Path" );
throw new FileSystemException( "/" + path + ": Invalid Path" );
}
return match;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public void list( @Nonnull String path, @Nonnull List<String> contents ) throws
}
else
{
throw new IOException( "Not a directory" );
throw new IOException( "/" + path + ": Not a directory" );
}
}

Expand All @@ -215,7 +215,7 @@ public long getSize( @Nonnull String path ) throws IOException
{
return file.getSize();
}
throw new IOException( "No such file" );
throw new IOException( "/" + path + ": No such file" );
}

@Nonnull
Expand Down Expand Up @@ -243,6 +243,6 @@ public InputStream openForRead( @Nonnull String path ) throws IOException
// treat errors as non-existance of file
}
}
throw new IOException( "No such file" );
throw new IOException( "/" + path + ": No such file" );
}
}