Commit Graph

33 Commits

Author SHA1 Message Date
whesse@google.com acd03abf83 dart:io: Use PathBuffer class for Directory.list on Windows platform.
BUG=https://code.google.com/p/dart/issues/detail?id=7505

Review URL: https://codereview.chromium.org//12252006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18448 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-13 15:00:55 +00:00
whesse@google.com 1a4082724c Revert changes to directory listing on Windows, to diagnose pub problems.
TBR=nweiz@google.com

BUG=

Review URL: https://codereview.chromium.org//12210086

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18260 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-08 16:47:33 +00:00
whesse@google.com 58e8b94008 Use a PathBuffer class in dart:io directory lister.
This simplifies the code, and avoids buffer overflow errors
by encapsulating snprintf.

BUG=

Review URL: https://codereview.chromium.org//12220034

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18247 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-08 11:58:12 +00:00
whesse@google.com 7f499abb04 Fix race condition in Directory.create.
BUG=https://code.google.com/p/dart/issues/detail?id=7679

Review URL: https://codereview.chromium.org//11794048

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16842 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-09 09:59:14 +00:00
ager@google.com b54f69bc18 Use unicode versions of all directory system calls on Windows.
R=sgjesse@google.com
BUG=

Review URL: https://codereview.chromium.org//11550014

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16043 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-12 15:01:48 +00:00
ager@google.com 8a14c1c319 Use FormatMessageW for Windows error messages to handle internationalized messages correctly.
R=sgjesse@google.com
BUG=dartbug.com/6986

Review URL: https://codereview.chromium.org//11558012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16041 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-12 14:39:21 +00:00
gram@google.com 3601944836 Revised CL for customisable logging (replacing printfs).
Review URL: https://codereview.chromium.org//11312242

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15096 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-19 17:38:15 +00:00
ager@google.com 28b43144e5 Update dart:io to convert strings between UTF8 and current code page
when interacting with the system.

What we get from and need to hand to the VM is utf8. What we
get from and need to hand to the system is in the current
code page.

R=sgjesse@google.com
BUG=

Review URL: https://codereview.chromium.org//11275281

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14851 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-13 15:03:23 +00:00
ager@google.com ccced31671 Change Directory.create to not fail on existing directory with that name.
The new semantics is to ensure that a directory with that name
exists. There is no way to reliably guard a create call against
existing directories in an async program.

R=sgjesse@google.com
BUG=

Review URL: https://codereview.chromium.org//11175054

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13933 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-23 09:15:01 +00:00
ager@google.com d2d65ee3b5 Fix for Directory.exists on Windows using GetFileAttributes
based on patch from Alexander Aprelev.

Discriminate different reasons for not being able to get
the file attributes. Currently this makes no difference since
both DOES_NOT_EXIST and UNKNOWN turn into a false return value
from Directory.existsSync().

R=sgjesse@google.com
BUG=3914

Review URL: https://chromiumcodereview.appspot.com//10916206

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12106 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-10 10:38:46 +00:00
rnystrom@google.com f65d68a677 When a directory contains read-only files, try to make them writable when recursively deleting on Windows.
Review URL: https://chromiumcodereview.appspot.com//10867003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11175 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-22 16:46:21 +00:00
rnystrom@google.com 1e14772bb0 Don't traverse through junctions when recursively deleting on Windows.
Review URL: https://chromiumcodereview.appspot.com//10825413

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11005 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-20 23:25:13 +00:00
ager@google.com 0d58bde8be Add support for directory renaming to dart:io.
R=sgjesse@google.com
BUG=dartbug:3104
TEST=standalone/io/directory*

Review URL: https://chromiumcodereview.appspot.com//10414046

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7848 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-22 12:46:25 +00:00
ager@google.com c278f6da23 Fix directory listing to actually have the semantics intended.
The directory listing will continue on error (such as broken links)
and the boolean indication when listing is complete will signal
if all operations succeeded.

R=sgjesse@google.com
BUG=dartbug.com/3031
TEST=standalone/io/file_system_links_test.dart

Review URL: https://chromiumcodereview.appspot.com//10381150

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7655 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-15 14:33:17 +00:00
sgjesse@google.com 471f1c772c Add error handling to directory
The directory object now has error handling like the rest of the
dart:io. The added tests to some extend overlaps with some of the
tests in DirectpryTest.dart, but I found it better to have error tests
in a single place.

I removed a few type checks sitting in the C++ code for the native
functions as for file we currently don't have them. I have opened
issue 2305 regarding where to do type checks for dart:io native
functions.

R=ager@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9773018

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5866 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-27 08:50:35 +00:00
sgjesse@google.com 84836f8c56 Error reporting on File in dart:io
This implements consistent error reporting on all methods on File in dart:io. The async onError method is called with an exception argument which is the same exception as would have been thrown from the corresponding sync method.

The one method on Directory which already did this has been updated as well.

R=ager@google.com

BUG=none
TEST=tests/standalone/src/io/FileTest.dart, tests/standalone/src/io/FileInvalidArgumentsTest.dart

Review URL: https://chromiumcodereview.appspot.com//9630012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5396 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-13 13:00:47 +00:00
sgjesse@google.com f0f34bf277 Add the ability to get the current directory
Added constructor current to directory. Use like this:

var cwd = Directory.current()

R=ager@google.com

BUG=dart:1793
TEST=tests/standalone/src/io/DirectoryTest.dart

Review URL: https://chromiumcodereview.appspot.com//9622001

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5087 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-07 13:23:08 +00:00
sgjesse@google.com e07a1f818e Fix bug in Directory after porting to using native ports
The full path was no longer provided to the directory handler

R=ager@google.com

TEST=tests/standalone/src/DirectoryTest.dart

BUG=

Review URL: https://chromiumcodereview.appspot.com//9452009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4521 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 11:13:35 +00:00
sgjesse@google.com 18df1964f7 Fix bug from r4390 on Windows
The file handler did not pass the full path.

R=ager@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9428002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4391 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-21 13:29:52 +00:00
sgjesse@google.com 9390f1577a Run all directory async operations on a separate thread using native ports
R=ager@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9310082

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4390 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-21 11:35:42 +00:00
ager@google.com 641cf84f6a Implement recursive directory deletion.
Additionally, make sure that the handler can be registered after
the operation in file and directory implementation:

  dir.delete();
  dir.deleteHandler = () => print('hest');

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9316066

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3892 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-03 12:37:30 +00:00
sgjesse@google.com 9f92d783ef Change temp dir generation on Windows to use UUIDs instead of random numbers
This avoids having to generate random numbers for all platforms as
only Windows was using them. Also when the andom number generator is
deterministic the Windows implementation using random numbers could
end up running out of temporary files.

R=whesse@google.com

BUG=
TEST=

Review URL: http://codereview.chromium.org//8879058

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2417 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-14 07:25:09 +00:00
sgjesse@google.com f2bda92a66 Add support for getting OS error information for creating temporary directories
R=whesse@google.com

BUG=
TEST=

Review URL: http://codereview.chromium.org//8934004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2385 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-13 14:22:50 +00:00
whesse@google.com f40da67d2b Add Directory.createTemp() to asynchronously create a temporary directory.
BUG=
TEST=

Review URL: http://codereview.chromium.org//8588029

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1741 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-22 13:06:39 +00:00
ager@google.com 87c2d27fcf Reapply directory error handling change.
Refactor code to have Platform::StrError(int error_code) on all
platforms. Use that to get better error messages on Windows as well.

BUG=
TEST=

Review URL: http://codereview.chromium.org//8511001

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1344 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-09 11:22:33 +00:00
ager@google.com fa2c0eca2e Revert "Post on the error handler in the Directory API when errors are encountered."
Breaks the mac build because of differences in strerror_r behavior.

R=sgjesse@google.com
BUG=
TEST=

Review URL: http://codereview.chromium.org//8509002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1339 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-09 08:33:43 +00:00
ager@google.com 99831629bf Post on the error handler in the Directory API when errors are encountered.
Terminate the listing operation at that point.

R=sgjesse@google.com
BUG=
TEST=

Review URL: http://codereview.chromium.org//8499018

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1338 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-09 08:08:50 +00:00
ager@google.com 953d2599c1 Add exists, create and delete to directory implementation on Linux and Mac.
All of the directory implementations on Linux and Mac are identical
and uncontroversial. Join the implementations in directory_posix for
now. I will split it into the two files again if it becomes necessary.

BUG=
TEST=

Review URL: http://codereview.chromium.org//8277033

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@432 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-14 12:42:44 +00:00
ager@google.com 10f298a6d4 Directory: implement recursive listing on Windows.
R=sgjesse@google.com
BUG=
TEST=

Review URL: http://codereview.chromium.org//8244004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@364 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-12 13:03:06 +00:00
ager@google.com 59135cc57b Clean up directory listing interface.
Remove open and close. A directory instance just holds a string
representing the path to the directory.

R=sgjesse@google.com
BUG=
TEST=

Review URL: http://codereview.chromium.org//8244001

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@362 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-12 10:39:30 +00:00
ager@google.com 30ede18056 Implement first version of directory listing library on Windows.
R=sgjesse@google.com
BUG=
TEST=

Review URL: https://chromereviews.googleplex.com/3543018

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@123 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-06 14:28:05 +00:00
ager@google.com 7c191c392b Fix Windows build after directory library changes.
R=sgjesse@google.com
BUG=
TEST=

Review URL: https://chromereviews.googleplex.com/3527012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-05 15:02:27 +00:00
dgrove@google.com 4c0f559d23 Initial checkin.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-05 05:20:07 +00:00