FlashSecurityRegistration.java

00001 package edu.stanford.hci.r3.flash;
00002 
00003 import java.io.File;
00004 
00005 import javax.swing.filechooser.FileSystemView;
00006 
00007 import edu.stanford.hci.r3.PaperToolkit;
00008 import edu.stanford.hci.r3.util.DebugUtils;
00009 import edu.stanford.hci.r3.util.files.FileUtils;
00010 
00025 public class FlashSecurityRegistration {
00026 
00027         public static void main(String[] args) {
00028                 // Find the FlashPlayer trust directory for this user...
00029                 String pathBeneathHomeDirectory = "Application Data/Macromedia/Flash Player/#Security/FlashPlayerTrust";
00030                 File desktopDirectory = FileSystemView.getFileSystemView().getHomeDirectory().getAbsoluteFile();
00031                 File homeDirectory = desktopDirectory.getParentFile();
00032                 File flashPlayerTrustDir = new File(homeDirectory, pathBeneathHomeDirectory);
00033 
00034                 // If it does not exist, we create the directory
00035                 if (!flashPlayerTrustDir.exists()) {
00036                         flashPlayerTrustDir.mkdirs();
00037                 }
00038 
00039                 // We add the cfg file (papertoolkit.cfg) listing the trusted directories
00040                 // e.g., PaperToolkit/flash/bin
00041                 File flashBinDir = new File(PaperToolkit.getToolkitRootPath(), "flash/bin");
00042                 String pathToAuthorizeForFlash = flashBinDir.getAbsolutePath();
00043                 
00044                 File destFile = new File(flashPlayerTrustDir, "papertoolkit.cfg");
00045                 FileUtils.writeStringToFile(pathToAuthorizeForFlash, destFile);
00046                 DebugUtils.println("Whitelisted [PaperToolkit/flash/bin] to avoid Flash's Security Sandboxing for Local SWF files...");
00047         }
00048 }

Generated on Sat Apr 14 18:21:35 2007 for R3 Paper Toolkit by  doxygen 1.4.7