Skip to content

Commit 381dff8

Browse files
committed
Merge pull request #152 from Ashton-W/aw-pbundlepath
Add 'pbundlepath' Print application's bundle directory path
2 parents de22648 + 478d0cd commit 381dff8

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

commands/FBPrintCommands.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def lldbcommands():
3131
FBPrintInstanceVariable(),
3232
FBPrintKeyPath(),
3333
FBPrintApplicationDocumentsPath(),
34+
FBPrintApplicationBundlePath(),
3435
FBPrintData(),
3536
FBPrintTargetActions(),
3637
FBPrintJSON(),
@@ -345,6 +346,28 @@ def run(self, arguments, options):
345346
os.system('open '+ pathString)
346347

347348

349+
class FBPrintApplicationBundlePath(fb.FBCommand):
350+
def name(self):
351+
return 'pbundlepath'
352+
353+
def description(self):
354+
return "Print application's bundle directory path."
355+
356+
def options(self):
357+
return [
358+
fb.FBCommandArgument(short='-o', long='--open', arg='open', boolean=True, default=False, help='open in Finder'),
359+
]
360+
361+
def run(self, arguments, options):
362+
path = fb.evaluateExpressionValue('(NSString*)[[NSBundle mainBundle] bundlePath]')
363+
pathString = '{}'.format(path).split('"')[1]
364+
cmd = 'echo {} | tr -d "\n" | pbcopy'.format(pathString)
365+
os.system(cmd)
366+
print pathString
367+
if options.open:
368+
os.system('open '+ pathString)
369+
370+
348371
class FBPrintData(fb.FBCommand):
349372
def name(self):
350373
return 'pdata'

0 commit comments

Comments
 (0)