Haxe compiler can't have absolute paths to libraries?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Haxe compiler can't have absolute paths to libraries?

luca deltodesco
haxe -swf-lib 'absolute-path-to-swf'

Error : SWF Library not found.

copy-paste the file path and run flash player on it, opens it fine.

use a relative path instead, opens it fine

(wtf?)

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Haxe compiler can't have absolute paths to libraries?

Nicolas Cannasse
Le 08/10/2011 22:01, luca deltodesco a écrit :
> haxe -swf-lib 'absolute-path-to-swf'
>
> Error : SWF Library not found.
>
> copy-paste the file path and run flash player on it, opens it fine.
>
> use a relative path instead, opens it fine
>
> (wtf?)

Try adding -cp ""

Nicolas


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

RE: Haxe compiler can't have absolute paths to libraries?

luca deltodesco
nope, though -cp "/" does work.

is there actually a good reason why this is necessary?

> Date: Sat, 8 Oct 2011 22:28:22 +0200

> From: [hidden email]
> To: [hidden email]
> Subject: Re: [haXe] Haxe compiler can't have absolute paths to libraries?
>
> Le 08/10/2011 22:01, luca deltodesco a écrit :
> > haxe -swf-lib 'absolute-path-to-swf'
> >
> > Error : SWF Library not found.
> >
> > copy-paste the file path and run flash player on it, opens it fine.
> >
> > use a relative path instead, opens it fine
> >
> > (wtf?)
>
> Try adding -cp ""
>
> Nicolas
>
>
> --
> haXe - an open source web programming language
> http://haxe.org

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Haxe compiler can't have absolute paths to libraries?

Nicolas Cannasse
Le 08/10/2011 23:22, luca deltodesco a écrit :
> nope, though -cp "/" does work.
>
> is there actually a good reason why this is necessary?

I don't remember why but there was several issues when adding / as part
of the default classpath.

Best,
Nicolas

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Haxe compiler can't have absolute paths to libraries?

jlm@justinfront.net

I don't remember why but there was several issues when adding / as part of the default classpath.

Best,
Nicolas


A long time ago with zinc I remember it was quite tricky to get class paths working with all versions of windows ( yep NT and 98? were slightly different ) and mac when creating cd at dyson, I don't know if this is related but here is what I shared on the zinc forum.  If it's out of date ( ie os systems have changed ) or not useful sorry to spam the list but just using a slash is probably not going to work cross platform.




import mdm.Application import mdm.Dialogs import mdm.FileSystem

/** * FileHelper * * To simplify use of saving and file access * on Hybrid (mac/pc) image view cds * * * * * * @author Justin L Mills of Justinfront * @contact JLM at justinfront dot net * @version 1.1 * * Assumes '*' are used in construction of generic paths * * * * * * * Example uses: * * [_code] * * filehelper = new FileHelper(ZXP); * moviecliploader = new MovieClipLoader(); * * * var fileLocation: String = filehelper.returnPathTo( 'images*image1.jpg' ); * * moviecliploader.loadClip( fileLocation, movieclip_holder ); * * button_mc.onRelease = fuction(){ *
* filehelper.copyFile( 'images*image2.eps' ); *
* }; * * [/_CODE] * * * */

class net.justinfront.FileHelper {

private static var SLASHES: String = '//'; private static var COLON: String = ':'; private static var STAR: String = '*'; private var _mdm; // zinc object private var win: Boolean; private var prog: Boolean; private var path: String; private var separator: String; private var folderNotSelected: String = "no folder selected"; private var __trace: Function;

//Passes in a reference to the zinc controlling instance setup at the start of the movie (zxp)

public function FileHelper( mdm_ ) { _trace('new FileHelper'); _mdm = mdm;

       init();

   }

/** * Initializes variables used in the public functions * * finds out if the system is windows or mac, * */ private function init( Void ):Void {

       //set win var true if windows
       win = isWindows();

       __trace( 'windows = ' + win )

       //set prog var true not a swf
       prog = inZINC();

       __trace( 'running in zinc = '+ prog);

   }

/** * * @usage Checks if windows or mac * @return true for windows * */

private function isWindows( Void ):Boolean { var sys: String = System.capabilities.os.toLowerCase();

       if( sys.indexOf( "win" ) == 0 )
       {

           separator = SLASHES;
           return true

       }

       if ( sys.indexOf( "mac" ) == 0 )
       {

           separator = COLON;
           return false

       }

       __trace( 'ERROR PLATFORM UNDEFINED ASSUME WINDOWS!' );

       return true;

   }

/** * * @usage Checks if in a Zinc * @return true if in zinc * */

private function inZINC( Void ): Boolean {

       var playerType = String( System.capabilities.playerType ).toLowerCase();

       if ( playerType == "external" || playerType == "standalone" )
       {

           return false;
       }

       path = _mdm.Application.path;

       __trace( 'path ' + path );

       return true;

   }

/** * Used for getting correct paths * * * Example use: * * filehelper = new FileHelper(ZXP); * * var fileLocation: String = filehelper.returnPathTo( 'images*image1.jpg' ); * * */

public function returnPathOf( end: String ):String {

       //Format path for platform
       end = (end.split( STAR )).join( separator );

       if( prog )
       {

           end = path + end;

       }

       __trace( 'end '+ end );

       return end

   }

/** * Used for saving files to the desktop * * * Example use: * * * button_mc.onRelease = fuction(){ *
* filehelper.copyFile( 'images*image2.eps' ); *
* }; * */

public function copyFile( file: String ) { //If not in zinc don't allow copyFile to do anything.

       if( !prog ){

           __trace( 'Can not copy file without Zinc!!!' );
           return

       }


       var copyTo:     String;
       var copyFrom:   String;
       var splitPath:  Array;

       var mdb =  _mdm.Dialogs.BrowseFolder;

       //find name
       var splitPath: Array = file.split( STAR );
       var fileName: String = splitPath[ splitPath.length-1 ];

       //and file path (pc or mac type)
       var copyFrom:String = returnPathOf( file );


       //open file browser to select folder
       mdb.title = 'Save '+ fileName + 'to ...';
       mdb.buttonText = 'Save To';
       copyTo = mdb.show();

       // Code wait's for user to choose a file

       if ( ( copyTo.length == 0 ) || ( copyTo == undefined ) || ( copyTo == "false" ) )
       {

           _mdm.Dialogs.promptModal( folderNotSelected, "ok", "alert" );
           return

       }


       //appends folder with file name
       copyTo += fileName;

       //debug trace
       __trace( 'copying from : ' + copyFrom + '  to:  ' + copyTo );

       //copy file
       _mdm.FileSystem.copyFile( copyFrom, copyTo );

   }

/** * Used to check if an instance is of this class * */

public function get className():String {

       return 'FileHelper'

   }

/** * Used to set a trace function for debugging * * @usage
* @param trace_ * @return
*/

public function set onTrace(trace_:Function):Void {

       __trace=trace_;

   }

}

On 9 Oct 2011, at 10:21, Nicolas Cannasse wrote:

Le 08/10/2011 23:22, luca deltodesco a écrit :
nope, though -cp "/" does work.

is there actually a good reason why this is necessary?

I don't remember why but there was several issues when adding / as part of the default classpath.

Best,
Nicolas

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org