F
fensterblick
Hello again from another relative newcomer. I am encountering a weird
issue when trying to write out a file to disk. I get a "No such file
or directory" error if the file path is greater than or equal to 194
characters. I have no problem with lengths less than 194 characters. I
am using Ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32].
Here is a very simplified version of my code that causes the issue:
backup_dir = "backup\\deployer\\172.00.00.00\\opt\\jboss\\server\
\default\\deploy\\birtdaemon.war\\WEB-INF\\plugins\
\org.eclipse.birt.report.data.oda.jdbc_2.1.1.v20070205-1728\\drivers\
\"
FileUtils.mkdir_p (backup_dir)
this_location_works = backup_dir + "abcdefghijklmnopqrst"
this_location_fails = backup_dir + "abcdefghijklmnopqrstu"
File.open( this_location_works, "wb" ) { |f| f.write "hello hello
hello..." }
File.open( this_location_fails, "wb" ) { |f| f.write "can't figure
out why this won't work!" }
As you can see, I am able to create one file but not the other. Is
this a bug or is there an error with my code? I searched through the
newgroup but I can't find any previous problems related to filepath
lengths.
Thanks for any help - I have to demo a script this week and I came
across this issue during testing. On a less urgent matter, I tried to
debug this code using ruby-debug, but I can't step into File.open().
How does one step through File.open()? My guess is that I cannot step
into it because it might not be written in Ruby (perhaps C?). If it is
written in C, where can I find the source code for it? Again, I'm a
newbie to Ruby so don't feel bad about including seemingly obvious
details in an answer.
issue when trying to write out a file to disk. I get a "No such file
or directory" error if the file path is greater than or equal to 194
characters. I have no problem with lengths less than 194 characters. I
am using Ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32].
Here is a very simplified version of my code that causes the issue:
backup_dir = "backup\\deployer\\172.00.00.00\\opt\\jboss\\server\
\default\\deploy\\birtdaemon.war\\WEB-INF\\plugins\
\org.eclipse.birt.report.data.oda.jdbc_2.1.1.v20070205-1728\\drivers\
\"
FileUtils.mkdir_p (backup_dir)
this_location_works = backup_dir + "abcdefghijklmnopqrst"
this_location_fails = backup_dir + "abcdefghijklmnopqrstu"
File.open( this_location_works, "wb" ) { |f| f.write "hello hello
hello..." }
File.open( this_location_fails, "wb" ) { |f| f.write "can't figure
out why this won't work!" }
As you can see, I am able to create one file but not the other. Is
this a bug or is there an error with my code? I searched through the
newgroup but I can't find any previous problems related to filepath
lengths.
Thanks for any help - I have to demo a script this week and I came
across this issue during testing. On a less urgent matter, I tried to
debug this code using ruby-debug, but I can't step into File.open().
How does one step through File.open()? My guess is that I cannot step
into it because it might not be written in Ruby (perhaps C?). If it is
written in C, where can I find the source code for it? Again, I'm a
newbie to Ruby so don't feel bad about including seemingly obvious
details in an answer.