Skip to content
Permalink
Browse files
FLEX-34446 give warning when trying to write to director you don't ha…
…ve permission to do so
  • Loading branch information
justinmclean committed Oct 10, 2014
1 parent 8320e47 commit 543bdd06ec90a5364beb0bd2ee73d303fef1a833
Showing 2 changed files with 48 additions and 9 deletions.
@@ -1096,14 +1096,27 @@ variables are not required because the locations of these pieces are known.
loader.addEventListener(ErrorEvent.ERROR, handleInstallerXMLError);
loader.addEventListener(IOErrorEvent.IO_ERROR, handleInstallerXMLError);
loader.load(req);
loader.load(req);
}
else {
showDirectoryState();
}
}
protected function handleFirstStepNextBtnClick(event:MouseEvent):void {
}
}
protected function handleFirstStepNextBtnClick(event:MouseEvent):void
{
// Quick check to see if the selected directory is writable
try {
var f:File = new File(_flexHome + File.separator + "flex.txt");
checkDirWritable(f);
} catch (e:Error) {
log(_viewResourceConstants.ERROR_UNABLE_TO_CREATE_TEMP_DIRECTORY);
flexSDKTxtInput.errorString = _viewResourceConstants.ERROR_DIR_REQUIRE_ADMIN_RIGHTS;
flexSDKTxtInput.prompt = _viewResourceConstants.ERROR_DIR_REQUIRE_ADMIN_RIGHTS;
updateActivityStep(_viewResourceConstants.STEP_CREATE_DIRECTORIES, StepItem.ERROR);
return;
}
showOptionsState();
}
@@ -1313,10 +1326,34 @@ variables are not required because the locations of these pieces are known.
file.addEventListener(Event.SELECT, flexSDKDirSelected, false, 0, true);
file.browseForDirectory(_viewResourceConstants.INFO_SELECT_DIRECTORY);
}
protected function flexSDKDirSelected(event:Event):void {
var selectedDir:File = File(event.target);
protected function checkDirWritable(file:File):void
{
var ba:ByteArray = new ByteArray();
ba.writeUTFBytes("1");
writeFileToDirectory(file, ba);
file.deleteFile();
}
protected function flexSDKDirSelected(event:Event):void
{
var selectedDir:File = File(event.target);
var overlay:Boolean = flexVersion.selectedItem.overlay;
// Quick check to see if the selected directory is writable
try {
var f:File = new File(selectedDir.nativePath + File.separator + "flex.txt");
checkDirWritable(f);
} catch (e:Error) {
log(_viewResourceConstants.ERROR_UNABLE_TO_CREATE_TEMP_DIRECTORY);
log(_viewResourceConstants.ERROR_DIR_REQUIRE_ADMIN_RIGHTS);
flexSDKTxtInput.text = selectedDir.nativePath;
flexSDKTxtInput.errorString = _viewResourceConstants.ERROR_DIR_REQUIRE_ADMIN_RIGHTS + " : " + selectedDir.nativePath; // tooltip
flexSDKTxtInput.prompt = _viewResourceConstants.ERROR_DIR_REQUIRE_ADMIN_RIGHTS; // field
updateActivityStep(_viewResourceConstants.STEP_CREATE_DIRECTORIES, StepItem.ERROR);
return;
}
overlaying = overlay;
if (!overlay)
{
@@ -1329,7 +1366,8 @@ variables are not required because the locations of these pieces are known.
flexSDKTxtInput.prompt = _viewResourceConstants.SELECT_PATH_PROMPT;
} else {
nextBtn.enabled = false;
flexSDKTxtInput.errorString = _viewResourceConstants.ERROR_DIR_NOT_EMPTY;
flexSDKTxtInput.text = selectedDir.nativePath;
flexSDKTxtInput.errorString = _viewResourceConstants.ERROR_DIR_NOT_EMPTY + " : " + selectedDir.nativePath;
flexSDKTxtInput.prompt = _viewResourceConstants.ERROR_DIR_NOT_EMPTY;
}
}
@@ -36,6 +36,7 @@ BTN_DISCLAIMER=Disclaimer
BTN_LABEL_OPEN_APACHE_FLEX_FOLDER=OPEN APACHE FLEX FOLDER
ERROR_CONFIG_XML_LOAD=Error while trying to load XML configuration file:
ERROR_DIR_NOT_EMPTY=The selected directory is not empty
ERROR_DIR_REQUIRE_ADMIN_RIGHTS=The selected directory requires Administrator rights to write files
ERROR_INVALID_AIR_SDK_URL_MAC=Adobe AIR SDK URL for Mac invalid in configuration file
ERROR_INVALID_AIR_SDK_URL_WINDOWS=Adobe AIR SDK URL for Windows invalid in configuration file
ERROR_INVALID_FLASH_PLAYER_SWC_URL=Flash Player swc URL invalid in configuration file

0 comments on commit 543bdd0

Please sign in to comment.