Home Download Buy Blog Forum Support

ST3: ExportHtml

Re: ST3: ExportHtml

Postby sublimator on Sat Feb 16, 2013 8:18 am

Or will that work on NT and I'm loopy?
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 649
Joined: Thu Mar 20, 2008 5:41 am

Re: ST3: ExportHtml

Postby skuroda on Sat Feb 16, 2013 8:21 am

castles_made_of_sand wrote:
Code: Select all
def get_package_and_asset(path):
    package = os.path.basename(os.path.dirname(path))
    package = package.replace(".sublime-package", "")
    asset = os.path.basename(path)
    return (package, asset)


I want my money back! Oh wait, I didn't pay any nor do I really care about windows absolute paths!


Looks at my poor poor windows machine that I am forced to use for development :(
skuroda
 
Posts: 690
Joined: Fri Oct 05, 2012 8:11 am

Re: ST3: ExportHtml

Postby sublimator on Sat Feb 16, 2013 8:22 am

Nevermind :) I'm satiated haha

os.path.basename

That's the one I was trying to think of the other day
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 649
Joined: Thu Mar 20, 2008 5:41 am

Re: ST3: ExportHtml

Postby sublimator on Sat Feb 16, 2013 8:22 am

skuroda wrote:Looks at my poor poor windows machine that I am forced to use for development :(


I think it'll be fine actually
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 649
Joined: Thu Mar 20, 2008 5:41 am

Re: ST3: ExportHtml

Postby sublimator on Sat Feb 16, 2013 8:32 am

Code: Select all
>>> import posixpath
>>> import ntpath
>>> ntpath.basename("C:\\fuck\\fucker")
'fucker'
>>> os.path is posixpath
True


Learn something every day
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 649
Joined: Thu Mar 20, 2008 5:41 am

Re: ST3: ExportHtml

Postby skuroda on Sat Feb 16, 2013 8:33 am

Yup I tested it after I posted. Also added the "with" statement. Hadn't seen that before, though I still should have done the try catch stuff. Oh well though, this is why it's good to share code.
skuroda
 
Posts: 690
Joined: Fri Oct 05, 2012 8:11 am

Re: ST3: ExportHtml

Postby sublimator on Sat Feb 16, 2013 8:36 am

Oh, wait, one more thing.

Will that helper handle nested assets? "Packages/Path/Subfolder/asset.pth"?
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 649
Joined: Thu Mar 20, 2008 5:41 am

Re: ST3: ExportHtml

Postby skuroda on Sat Feb 16, 2013 8:37 am

It will as soon as I fix it?

edit:
the "too" at the end was wrong and bothering me.
Last edited by skuroda on Sat Feb 16, 2013 9:29 am, edited 1 time in total.
skuroda
 
Posts: 690
Joined: Fri Oct 05, 2012 8:11 am

Re: ST3: ExportHtml

Postby sublimator on Sat Feb 16, 2013 8:39 am

It will as soon as I fix it too?


Haha, good answer

There's also the bytes/unicode inconsistency on python 3 between zipfile open and normal open
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 649
Joined: Thu Mar 20, 2008 5:41 am

Re: ST3: ExportHtml

Postby skuroda on Sat Feb 16, 2013 9:42 am

Had to go take care of some other things, so that took longer than I wanted it to. Anyways, it should now handle nested assets. Also, everything is returned as bytes now.
skuroda
 
Posts: 690
Joined: Fri Oct 05, 2012 8:11 am

PreviousNext

Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 5 guests