Okay - nice work - but after installing Guy Watson's extension, and then
disabling it, I get a native error for this line of code:
var classLocation = fl.configURI+"/Classes/";
The error: Exception thrown in native function.
Any clue whats going on? Before installing the extension, that line worked
perfectly. Do I need to snag a base copy of that .dll and replace the one I
now have?
- edolecki
On 2/16/06, Johannes Nel <[EMAIL PROTECTED]> wrote:
>
> as a side note. on usage :)
>
> lets say i want to import the xfactor xpath classes, just point it to the
> com directory and the whole com thinga'mabob gets copied over.
>
> On 2/16/06, Johannes Nel <[EMAIL PROTECTED]> wrote:
> >
> > nothing a bit of plagarism and a slight rewrite couldn't sort out. go
> > through my added comments in the code i see some pitfalls, but could not
> > realise them.
> >
> >
> >
> > var folderURI = fl.browseForFolderURL("Please select your package.");
> > var folderContents = FLfile.listFolder( folderURI, "directories" );
> > var classesLocation = fl.configURI+"/Classes/";
> > var bInstall = confirm("Install the package: " + folderURI + "?");
> >
> > if( bInstall == true ){
> > //create the folder we are copying to if it does not exist
> > var target = classesLocation + getTopDirectoryFromOrigen(folderURI)
> +
> > "/";
> > createFolder(target)
> > copyFolder(folderURI +"/",target,true);
> > } else {
> > fl.trace( "Installation cancelled." );
> > }
> > function getTopDirectoryFromOrigen(uri)
> > {
> > var arr = uri.split("/");
> > return arr[ arr.length-1];
> > }
> > function createFolder(uri)
> > {
> > if(!FLfile.exists(uri))
> > {
> > FLfile.createFolder(uri);
> > }
> > }
> > /**
> > * the rest of these functions were written for dreamweaver
> > * by Danilo Celic with the odd modification by me
> > * http://www.communitymx.com/blog/index.cfm?newsid=237
> > */
> >
> > function copyFolder(start, end, overwrite){//1.0_DC
> > // Copy the folders
> > var theFolders = getAllFolders(start);
> > var theFiles = getAllFiles(start);
> > for(var i=0;i<theFolders.length;i++){
> >
> > theFolders[i] = theFolders[i].substring(start.length);
> > //jpn modification for recursivness
> > var zeFolder = theFolders[i];
> >
> > theFolders[i] = end + theFolders[i];
> > if(!FLfile.exists(theFolders[i])){
> > FLfile.createFolder(theFolders[i]);
> > }
> > //jpn modification to the orinial script to make zis sucker
> > recursive
> > //NOTE this comparision.
> > //i do not believe that this is perfect and can see problems
> with
> > it, but its fly for now
> > if((start + zeFolder)!= start)
> > {
> > copyFolder(start + "/" + zeFolder,end + "/" +
> > zeFolder,overwrite);
> > }
> > }
> > for (i=0; i < theFiles.length; i++){
> > var folderPath = theFiles[i].substring(start.length);
> > if(overwrite){
> > if(FLfile.exists(end + folderPath)){
> > FLfile.remove(end + folderPath);
> > theResult = FLfile.copy(theFiles[i], end + folderPath);
> > if (!theResult)
> > {
> > fl.trace('error on copy 0' + end + folderPath);
> > }
> > }
> > else//jpn modification: added this else section this should
> be
> > refactored as there is repetition!!!
> > {
> > theResult = FLfile.copy(theFiles[i], end + folderPath);
> > if (!theResult)
> > {
> > fl.trace('error on copy 1' + end + folderPath);
> > }
> > }
> > }
> > else
> > {
> > if(!FLfile.exists(end + folderPath)){
> > theResult = FLfile.copy(theFiles[i], end + folderPath);
> > if (!theResult) fl.trace('error on copy 2'+ end +
> > folderPath);
> > }
> > }
> > }
> > }
> >
> > //Traverse the folder passed in and return an array of all the folders
> > within it
> > //Design Notes files are already filtered
> > function getAllFolders(theFolderURL){//1.1_DC
> > var dirArray = new Array();
> > dirArray[0] = theFolderURL;
> > for(var x=0 ; x < dirArray.length ;x++){
> > //Put together an array of directories
> > theDirs = FLfile.listFolder(dirArray[x], 'directories');
> > for(var i=0;i<theDirs.length ;i++)
> > {
> > //Filter out the Design Notes folder
> > if(theDirs[i] != '_notes'){
> > dirArray.push(dirArray[x]+theDirs[i]+'/');
> > }
> > }
> > }
> > return dirArray;
> > }
> >
> > //Traverse the folder passed in and return an array of all the files
> > within it
> > function getAllFiles(theFolderURL){ //1.1_DC
> > var returnFileArray = new Array();
> > var theDirs = getAllFolders(theFolderURL);
> > var theFiles = new Array();
> > for(var i= 0;i<theDirs.length ;i++){
> > theFiles = FLfile.listFolder(theDirs[i] + '/*' ,'files');
> > for(var k=0;k<theFiles.length ;k++){
> > returnFileArray.push(theDirs[i]+ theFiles[k]);
> > }
> > }
> > return returnFileArray;
> > }
> >
> >
> >
> > On 2/16/06, eric dolecki <[EMAIL PROTECTED]> wrote:
> > >
> > > Okay cool, because when I get the folderURI - I alert through and its
> > > correct, the copyFolder operation, using folderURI actuallly copies
> the
> > > contents INSIDE the folderURI, and not the folderURI itself -
> > > frustrating!
> > >
> > > -edolecki
> > >
> > >
> > > On 2/16/06, Johannes Nel <[EMAIL PROTECTED]> wrote:
> > > >
> > > > hang on 5 minutes. i almost have it working using flFile, which will
> > > make
> > > > it
> > > > Mac usable as well/
> > > >
> > > > On 2/16/06, eric dolecki <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > > Ok - I downloaded Guy's FileSystem extension and there is
> something
> > > > called
> > > > >
> > > > > FileSystem.copyFolder( param1, param2 );
> > > > >
> > > > > which rocks. But I want to get the base folder & copy it... when i
> > > do
> > > > > this:
> > > > >
> > > > > var folderURI = fl.browseForFolderURL( "choose folder to copy
> > > to
> > > > > class
> > > > > location" );
> > > > >
> > > > > that gives me the CONTENTS of the folder, not the folder itself.
> So
> > > what
> > > > > ends up happening, I copy all of the contents of the folder, not
> the
> > > > main
> > > > > folder itself.
> > > > >
> > > > > How do I get that folder as the file URI ?
> > > > >
> > > > > My code:
> > > > >
> > > > >
> > > > >
> > > > > var folderURI = fl.browseForFolderURL( "JSFL PACKAGE
> > > > > INSTALATION\n\n\nPlease
> > > > > select the class package (folder) you wish to install:",
> > > "directories"
> > > > );
> > > > >
> > > > > if( folderURI == null ){
> > > > > alert( "Aborting Installation" );
> > > > > } else {
> > > > > continueProcess();
> > > > > }
> > > > >
> > > > > function continueProcess(){
> > > > > var classLocation = fl.configURI + "Classes";
> > > > > var bInstall = confirm("Would you like to install the
> > > package\nthat
> > > > > you
> > > > > selcted at this location:\n\n" + folderURI + "?");
> > > > >
> > > > > if( bInstall == true ){
> > > > > FileSystem.copyFolder( folderURI, classLocation );
> > > > > alert( "The Package has been installed." );
> > > > > } else {
> > > > > alert( "Installation cancelled." );
> > > > > }
> > > > > }
> > > > > _______________________________________________
> > > > > [email protected]
> > > > > To change your subscription options or search the archive:
> > > > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> > > > >
> > > > > Brought to you by Fig Leaf Software
> > > > > Premier Authorized Adobe Consulting and Training
> > > > > http://www.figleaf.com
> > > > > http://training.figleaf.com
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > j:pn
> > > > _______________________________________________
> > > > [email protected]
> > > > To change your subscription options or search the archive:
> > > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> > > >
> > > > Brought to you by Fig Leaf Software
> > > > Premier Authorized Adobe Consulting and Training
> > > > http://www.figleaf.com
> > > > http://training.figleaf.com
> > > >
> > > _______________________________________________
> > > [email protected]
> > > To change your subscription options or search the archive:
> > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> > >
> > > Brought to you by Fig Leaf Software
> > > Premier Authorized Adobe Consulting and Training
> > > http://www.figleaf.com
> > > http://training.figleaf.com
> > >
> >
> >
> >
> > --
> > j:pn
> >
>
>
>
> --
> j:pn
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com