- Timestamp:
- 04/29/19 10:48:40 (5 years ago)
- Location:
- trunk/src/org/expeditee
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/auth/Actions.java
r1323 r1331 529 529 530 530 // Copy private resources to personal area 531 Path personalResources = FrameIO.setupPersonalResources(username);531 Path personalResources = UserSettings.PublicAndPrivateResources ? FrameIO.setupPersonalResources(username) : Paths.get(FrameIO.PARENT_FOLDER); 532 532 533 533 File contactsDir = new File(personalResources.resolve("contacts").toAbsolutePath().toString()); -
trunk/src/org/expeditee/gui/FrameUtils.java
r1270 r1331 29 29 import java.net.URL; 30 30 import java.net.URLConnection; 31 import java.nio.file.FileVisitResult; 32 import java.nio.file.FileVisitor; 33 import java.nio.file.Files; 31 34 import java.nio.file.Path; 32 35 import java.nio.file.Paths; 36 import java.nio.file.attribute.BasicFileAttributes; 33 37 import java.util.ArrayList; 34 38 import java.util.Arrays; … … 49 53 import org.expeditee.agents.ExistingFramesetException; 50 54 import org.expeditee.agents.InvalidFramesetNameException; 55 import org.expeditee.auth.AuthenticatorBrowser; 51 56 import org.expeditee.auth.gui.MailBay; 52 57 import org.expeditee.core.Colour; … … 1835 1840 Path resourcesPublic = Paths.get(FrameIO.PARENT_FOLDER).resolve("resources-public"); 1836 1841 extractResources("org/expeditee/assets/resources-public", resourcesPublic, force); 1842 } else if (AuthenticatorBrowser.isAuthenticationRequired()) { 1843 // Deal with the instance of being in the old regime but using authentication. 1844 1845 // Ensure additional framesets 1846 Path framesetsDir = Paths.get(FrameIO.FRAME_PATH); 1847 boolean extracted = extractResources("org/expeditee/assets/resources-public/framesets", framesetsDir, force); 1848 1849 // Ensure additional images 1850 Path imagesDir = Paths.get(FrameIO.IMAGES_PATH); 1851 extracted |= extractResources("org/expeditee/assets/resources-public/images", imagesDir, force); 1852 1853 // Ensure deaddrops area exists 1854 Paths.get(FrameIO.PARENT_FOLDER).resolve("deaddrops").toFile().mkdir(); 1855 1856 if (extracted) { 1857 // Ensure the default profile is 'update to date'. 1858 //NB: this limits the potential for those running old regime with authentication the ability to customise the default profile. 1859 Path defaultProfile = Paths.get(FrameIO.PROFILE_PATH).resolve("default"); 1860 try { 1861 Files.walkFileTree(defaultProfile, new FileVisitor<Path>() { 1862 @Override 1863 public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { 1864 dir.toFile().delete(); 1865 return FileVisitResult.CONTINUE; 1866 } 1867 @Override 1868 public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { 1869 return FileVisitResult.CONTINUE; 1870 } 1871 @Override 1872 public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { 1873 file.toFile().delete(); 1874 return FileVisitResult.CONTINUE; 1875 } 1876 @Override 1877 public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { 1878 return FileVisitResult.CONTINUE; 1879 } 1880 }); 1881 } catch (IOException e) { 1882 e.printStackTrace(); 1883 } 1884 } 1837 1885 } 1838 1886 } 1839 1887 1840 private static voidextractResources(String source, Path destination, boolean force) {1888 private static boolean extractResources(String source, Path destination, boolean force) { 1841 1889 // If resources have already been extracted, and we are not forcing the extraction, there is nothing to do. 1842 1890 if (!force && destination.resolve(".res").toFile().exists()) { 1843 return ;1891 return false; 1844 1892 } 1845 1893 … … 1893 1941 System.err.println("Error: FrameUtils::extractResources. Unable to create the .res file to flag that resources have been extracted. Message: " + e.getMessage()); 1894 1942 } 1943 1944 return true; 1895 1945 } 1896 1946
Note:
See TracChangeset
for help on using the changeset viewer.