Sublime Forum

OS path in menu

#1

How I can type OS path in Main.sublime-menu?

"command": "open_file",
"args": {"file": "${os_path}/drivers/etc/hosts"

Its not works

0 Likes

#2

Any ideas?

0 Likes

#3

What are you expecting ${os_path} to do?

0 Likes

#4

Return string “C:\Windows”
because

"command": "open_file", "args": {"file": "C:/Windows/drivers/etc/hosts"
not works

0 Likes

#5

You may have luck with /C/Windows/drivers/etc/hosts

0 Likes

#6

Any chances to have an API method to do the conversion ?

0 Likes

#7

Thanks. It works

0 Likes

#8

I know that I’m “bringing from death” this topic, but I must :smile: Thanks @jps for precise and so easy solutionQ I add next code to Main.sublime-menu (on Windows 7) and now it works like a charm:

[code] {
“caption”: “Tools”,
“mnemonic”: “t”,
“id”: “tools”,
“children”:

     { "command": "open_file", "caption": "Edit hosts", "mnemonic": "h", "args": {"file":"/C/Windows/System32/drivers/etc/hosts"}}
  ]

}
[/code]

Cheers

0 Likes