Skip to content

Commit

Permalink
#169: Fixed edit exif same file
Browse files Browse the repository at this point in the history
  • Loading branch information
k3b committed Mar 15, 2021
1 parent 4f8a3e4 commit fb68b02
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public class DocumentFileTranslator {
* Mapping from known File to DocumentFile-Directory translation
*/
private final Map<File, DocumentFile> dirCache = new HashMap<>();
protected final DocumentFileCache documentFileCache = new DocumentFileCache();
protected DocumentFileCache documentFileCache = new DocumentFileCache();


private static final File internalRootCandidate = new File("/storage/emulated/0");
Expand Down Expand Up @@ -100,6 +100,8 @@ private DocumentFileTranslator init() {
for (Map.Entry<String, String> enty : root.dir2uri.entrySet()) {
add(new File(enty.getKey()), DocumentFile.fromTreeUri(context, Uri.parse(enty.getValue())));
}
documentFileCache = new DocumentFileCache();

return this;
}

Expand Down
2 changes: 1 addition & 1 deletion fotolib2/src/main/java/de/k3b/io/FileCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ protected int moveOrCopyFiles(final boolean move, String what, PhotoPropertiesDi

if (exifChanges == null) {
// get info for potential xmp sidecare BEFORE jpg (sourceFile) is moved away
String jpgName = sourceFile.getName();
String jpgName = sourceFile.getName();//!!!
final IFile jpgParentFile = sourceFile.getParentFile();

// old style move/copy image with sidecarfile(s)
Expand Down
8 changes: 4 additions & 4 deletions fotolib2/src/main/java/de/k3b/media/ExifInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -1416,10 +1416,10 @@ public void saveAttributes(IFile inFile, IFile outFile,
if (overwriteOriginal) {
final String name = inFile.getName();
final String tempName = name + TMP_FILE_SUFFIX;
// inFile.setCacheStrategy(3); //!!!
inFile = renameSouraceFileBeforeReplaceOrThrow(inFile, tempName);

currentOutFile = outFile.getParentFile().create(name);
inFile = renameSouraceFileBeforeReplaceOrThrow(inFile.cacheStrategy(IFile.STRATEGY_NONE), tempName).cacheStrategy(IFile.STRATEGY_NONE);
currentOutFile = outFile.getParentFile().create(name).cacheStrategy(IFile.STRATEGY_NONE);
} else {
currentOutFile.cacheStrategy(IFile.STRATEGY_OUTPUT);
}

saveJpegAttributes(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,14 +342,10 @@ protected void setFile(File file) {
}


/**
* true: forInput; false: forOutput; null: disable cache
*/
@Override
public int setCacheStrategy(int strategyID) {
int old = this.strategyID;
public IFile cacheStrategy(int strategyID) {
this.strategyID = strategyID;
return old;
return this;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,9 @@ public long length() {
}

@Override
public int setCacheStrategy(int strategyID) {
return child.setCacheStrategy(strategyID);
public IFile cacheStrategy(int strategyID) {
child.cacheStrategy(strategyID);
return this;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,7 @@ public interface IFile {
long length();

//------- file cache support

/**
* 0: forInput; 1: forOutput; 3: disable cache.
*/
int setCacheStrategy(int strategyID);
IFile cacheStrategy(int strategyID);

void invalidateParentDirCache();
}
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ public long length() {
}

@Override
public int setCacheStrategy(int strategyID) {
return 0;
public IFile cacheStrategy(int strategyID) {
return this;
}

@Override
Expand Down

0 comments on commit fb68b02

Please sign in to comment.