简体   繁体   中英

How do I set Windows-related file attributes in ruby?

如何告诉ruby创建属性为FILE_ATTRIBUTE_TEMPORARYFILE_FLAG_DELETE_ON_CLOSE

You can call Windows functions using the Ruby win32api library. See these examples . It's painful, but it works.

我使用了Ruby 1.8.7的源代码,却没有提到这些属性,因此我认为您可以修复它并从源代码进行构建...

Probably because of it's Unix roots, Ruby doesn't (yet) allow that. You can probably obtain the result you want with:

require 'tempfile'
Tempfile.new "my_temp_file" do |f|
  #...
end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM