开发者

opening a parent folder and highlighting particular child in default file browser using python

开发者 https://www.devze.com 2023-01-21 08:29 出处:网络
I am using following code to open a folder in default file browser. if os.name == \'mac\': subprocess.call((\'open\', folderPath))

I am using following code to open a folder in default file browser.

if os.name == 'mac':
  subprocess.call(('open', folderPath))
elif os.name == 'nt':
 开发者_运维技巧 subprocess.call(('start', folderPath))
elif os.name == 'posix':
  subprocess.call(('xdg-open', folderPath))

Now the problem is I want to highlight the child folder/file which was selected earlier. Is there any way to do it? If not for all, at least for nautilus?


xdg-open doesn't support this, so it has to be done on a per-app basis. After poking around the Nautilus code, I don't think it has this feature either. So, yeah, you're pretty much out of luck.

For Windows Explorer, you can use

subprocess.call(("explorer", "/select,", file_path))
0

精彩评论

暂无评论...
验证码 换一张
取 消