Re: [Swingosc-devel] [sc-dev] Re: (J)SCTextView linkAction, open(URL), etc.
Brought to you by:
sciss
From: nescivi <ne...@gm...> - 2009-01-03 03:24:25
|
On Friday 02 January 2009 11:43:27 Scott Wilson wrote: > On 2 Jan 2009, at 14:36, nescivi wrote: > > so... would we just check for "://" anywhere in the url? > > > > so it would be: > > > > open { arg path; > > path = path.replace( ' ', '%20' ); > > if ( path.contains( "://" ).not, { > > if ( path.first.asString != "/" ) { path = String.scDir +/+ > > path; }; > > path = "file://"++path; > > }); > > // this.openURL( "file://"++path ); > > server.sendMsg( '/method', this.id, \setPage, '[', '/new', > > "java.net.URL", > > path, ']' ); > > } > > Yes, I think that would be good, although probably sensible to handle > sc: scheme urls here as well. Is there a cross-platform way of doing a > help search? Help:tree would probably work with a little adaptation. this diff to SwingOSC should do it. ok to commit? (openURL will just be used as a forwarding method). sincerely, Marije Index: SuperCollider/SCClassLibrary/SwingOSC/JSCViews1.sc =================================================================== --- SuperCollider/SCClassLibrary/SwingOSC/JSCViews1.sc (revision 131) +++ SuperCollider/SCClassLibrary/SwingOSC/JSCViews1.sc (working copy) @@ -2314,7 +2314,16 @@ path = path.tr($\\, $/); }); path = path.replace( ' ', '%20' ); - this.openURL( "file://"++path ); + + if ( path.contains( "SC://"), { + path = Help.findHelpFile( path.asRelativePath( "SC:/") ); + }); + + if ( path.contains( "://" ).not, { + if ( path.first.asString != "/" ) { path = String.scDir +/+ path; }; + path = "file://"++path; + }); + this.openURL( path ); } |