是否有人在Windows上遇到过Ramaze的文件锁定问题?我上传的所有文件都被锁定了(我使用的是上传助手btw)。
我使用的是- Ruby 1.93 - Ramaze-2012.04.14 - Rack-1.4.1
谢谢!
发布于 2012-05-01 21:59:44
回答我自己的问题。看起来罪魁祸首在ramaze/helper/upload.rb中
@realfile = File.new(path) #--->this opens the uploaded/saved file, thus locking it我用这个修补了我的本地upload.rb副本--
class UploadedFile
include Ramaze::Traited
# Suggested file name
# @return [String]
attr_reader :filename
# MIME-type
# @return [String]
attr_reader :type
# Saved file object
# @return [File]
attr_reader :realfile #---> expose the variable so we can close it from the caller然后在调用者中,只需在保存文件后将其关闭,如下所示...
get_uploaded_files.each_pair{|k, v|
v.save "upload/#{v.filename}"
v.realfile.close #close the file handle
}我很快就会提交一个补丁...
https://stackoverflow.com/questions/10390127
复制相似问题