Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to get the current working directory in dart script #1904

Closed
efortuna opened this issue Feb 28, 2012 · 3 comments
Closed

Add ability to get the current working directory in dart script #1904

efortuna opened this issue Feb 28, 2012 · 3 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-duplicate Closed in favor of an existing report library-io type-enhancement A request for a change that isn't a bug

Comments

@efortuna
Copy link
Contributor

Currently, the only way I can find to determine what directory the user is in is by running
new Process.start('pwd') and adding a lineHandler to capture the output, which is not OS-independent and unclear whether it would even work since the Windows equivalent is echo %cd%, which requires running in the shell.

@DartBot
Copy link

DartBot commented Feb 28, 2012

This comment was originally written by ladicek@gmail.com


I've got a slighly better one (tested on Linux only, but I bet it works elsewhere too):

  Directory cwd() => new Directory(new File(".").fullPathSync());

  var d = cwd();
  print(d.path);
  print(d.existsSync());

Not ideal, though. I'd love to see a Directory.current() constructor -- and there's even a bug for that, http://code.google.com/p/dart/issues/detail?id=1793

@efortuna
Copy link
Contributor Author

Added Duplicate label.
Marked as being merged into #1793.

@kevmoo
Copy link
Member

kevmoo commented May 14, 2014

Removed Area-IO label.
Added Area-Library, Library-IO labels.

@efortuna efortuna added Type-Enhancement area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io closed-duplicate Closed in favor of an existing report labels May 14, 2014
@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed type-enhancement labels Mar 1, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-duplicate Closed in favor of an existing report library-io type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants