Skip to content

Commit

Permalink
Fix export for Android <Q
Browse files Browse the repository at this point in the history
  • Loading branch information
Baltasarq committed Jul 17, 2022
1 parent 80bd09d commit f0070cb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
2 changes: 0 additions & 2 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
public class AppInfo {
public static final String AUTHOR = "dev::baltasarq";
public static final String EMAIL = "baltasarq@gmail.com";
public static final String VERSION = "1.2.0";
public static final String SERIAL = "20220109";
public static final String VERSION = "1.2.1";
public static final String SERIAL = "20220711";
public static final String LICENSE = "MIT license";
public static final String COPYRIGHT = "(c) 2019/22";

Expand Down
25 changes: 13 additions & 12 deletions app/src/main/java/com/devbaltasarq/nadamillas/core/DataStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,9 @@ public void saveToDownloads(String fn, String mimeType) throws IOException
throw new IOException( "unable to save to /Downloads" );
}
} else {
copyFile( new File( fn ), new File( DIR_DOWNLOADS, fn ) );
final File FN = new File( fn );

copyFile( FN, new File( DIR_DOWNLOADS, FN.getName() ) );
}

return;
Expand Down Expand Up @@ -1051,19 +1053,18 @@ public File createTempFile(String prefix, String suffix) throws IOException
*/
private static void copyFile(File source, File dest) throws IOException
{
final String errorMsg = "error copying: " + source + " to: " + dest + ": ";
InputStream is;
OutputStream os;

try {
is = new FileInputStream( source );
os = new FileOutputStream( dest );

copyStream( is, os );
} catch(IOException exc)
try (InputStream is = new FileInputStream( source );
OutputStream os = new FileOutputStream( dest ))
{
Log.e( LOG_TAG, errorMsg + exc.getMessage() );
throw new IOException( errorMsg );
copyStream( is, os );
} catch (IOException exc) {
final String ERROR_MSG = "error copying: " + source
+ " to: " + dest
+ ": " + exc.getMessage();

Log.e( LOG_TAG, ERROR_MSG );
throw new IOException( ERROR_MSG );
}

return;
Expand Down

0 comments on commit f0070cb

Please sign in to comment.