File.unlink(nonwestern_filename) ---> Error on Windows
- From: johan556@xxxxxxxxx
- Date: Thu, 5 Jul 2007 22:00:43 +0900
Hi!
I use Ruby on Windows, and tried to remove all files in a directory
with the code given below. But if the directory contains files with
filenames having non-western characters the operation fails.
I first encountered this problem when using FileUtils.rm_r, and that
method also fails (for the same reason I guess). This makes FileUtils
quite useless in some situations. We have for example Subversion
projects that contain files with Japanese characters (for testing that
our product works with such characters), and I also tried with Arabic
characters (stored in Unicode in NTFS in both cases).
Is it possible to get Ruby to work with filenames containing
non-western characters at all on Windows? If so, what should I do?
/Johan Holmberg
--------------
Dir.chdir "nonwestern-files"
for entry in Dir.entries(".")
next if entry == "."
next if entry == ".."
n = File.unlink(entry)
puts "failed to delete #{entry}" if n == 0
end
--------------
.
- Follow-Ups:
- Re: File.unlink(nonwestern_filename) ---> Error on Windows
- From: John Joyce
- Re: File.unlink(nonwestern_filename) ---> Error on Windows
- Prev by Date: Re: [ANN] flatulent-0.0.3
- Next by Date: Re: mouse block and key pressed simulation?
- Previous by thread: [SUMMARY] LSRC Name Picker (#129)
- Next by thread: Re: File.unlink(nonwestern_filename) ---> Error on Windows
- Index(es):
Relevant Pages
|