SyntaxHighlighter

2015年4月1日水曜日

カレントディレクトリをExplorerで開く

別アプリで書かれていたものを丸パクリしたもの

import nuke
import os.path
import sys
def openCurrent():
path = nuke.root().name()
if path == 'Root':
print('#[WARNING]: No scene is opened.')
return
nkp = '\\'.join(path.split('/')[:-1])
if os.path.isdir(nkp):
os.popen('explorer "%s"' % nkp)
print('>> Open: %s' % nkp)
else:
print('#[WARANING]: Directory not found: %s' % nkp)
openCurrent()

<pre class="brush: python;">
// ココにソースを記述
</pre>

0 件のコメント:

コメントを投稿