Use cache directory for avatars

cusax-fix 4968
Ingo Bauersachs 12 years ago
parent 5baad8c1ad
commit 77afb67764

@ -45,8 +45,7 @@ public static void deleteImage(int index)
{
File imageFile
= DesktopUtilActivator.getFileAccessService()
.getPrivatePersistentFile(
fileName);
.getPrivatePersistentFile(fileName, FileCategory.CACHE);
if (imageFile.exists() && !imageFile.delete())
logger.error("Failed to delete stored image at index " + index);
@ -73,8 +72,7 @@ public static BufferedImage loadImage(int index)
imageFile
= DesktopUtilActivator.getFileAccessService().
getPrivatePersistentFile(
imagePath);
getPrivatePersistentFile(imagePath, FileCategory.CACHE);
}
catch (Exception e)
{
@ -110,11 +108,13 @@ private static void moveImage(int oldIndex, int newIndex)
try
{
FileAccessService fas = DesktopUtilActivator.getFileAccessService();
File oldFile = fas.getPrivatePersistentFile(oldImagePath);
File oldFile = fas.getPrivatePersistentFile(oldImagePath,
FileCategory.CACHE);
if (oldFile.exists())
{
File newFile = fas.getPrivatePersistentFile(newImagePath);
File newFile = fas.getPrivatePersistentFile(newImagePath,
FileCategory.CACHE);
oldFile.renameTo(newFile);
}
@ -149,12 +149,14 @@ public static void storeImage(BufferedImage image, int index)
try
{
FileAccessService fas = DesktopUtilActivator.getFileAccessService();
File storeDir = fas.getPrivatePersistentDirectory(STORE_DIR);
File storeDir = fas.getPrivatePersistentDirectory(STORE_DIR,
FileCategory.CACHE);
// if dir doesn't exist create it
storeDir.mkdirs();
File file = fas.getPrivatePersistentFile(imagePath);
File file = fas.getPrivatePersistentFile(imagePath,
FileCategory.CACHE);
ImageIO.write(image, "png", file);
}

Loading…
Cancel
Save