LoginSignup
12

More than 5 years have passed since last update.

node.jsでWindowsのパスにする

Last updated at Posted at 2014-06-10

背景

Atom Shellでshell#showItemInFolderを使おうとしたら、__dirnameで得られるc:/work/pathの形式だと、エクスプローラーが開かず。どうやら、c:\work\pathな形式でないと動かないことが分かった。

c:/work/pathな形式をc:\work\pathにする方法

Node.js標準のpathモジュールで出来た。

var path=require('path');

var filePath = "c:/work/path";
console.log(path.resolve(filePath));

関連記事

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12