Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私はnodejsアプリを持っています。
アプリのルート ディレクトリへの絶対パスを取得するにはどうすればよいですか? var rootDir = ....
var absolute_path = __dirname;
これまでのところ、ルート ディレクトリが "/app" になっていることしか確認できませんでした。
3年後では少し遅いですが、将来の世代のために。__dirname の問題は、それが呼び出されたファイルにのみ関連しています。
nodejs のパス モジュールを使用して、アプリのルート パスを取得します
path.dirname(require.main.filename)
For example, I have a class that says
public class KeyList extends Vector<Object> { }
but it never specifically creates a new Vector of any kind. This is part