Sha256: c123ffa6ef2e7c0652ad4e057d4e9ba2c08558d97d00ca54b49144eba58ccce7

Contents?: true

Size: 971 Bytes

Versions: 6

Compression:

Stored size: 971 Bytes

Contents

#
# Fluentd
#
#    Licensed under the Apache License, Version 2.0 (the "License");
#    you may not use this file except in compliance with the License.
#    You may obtain a copy of the License at
#
#        http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.
#

module Fluent
  module FileUtil
    # Check file is writable if file exists
    # Check directory is writable if file does not exist
    #
    # @param [String] path File path
    # @return [Boolean] file is writable or not
    def writable?(path)
      path = File.exist?(path) ? path : File.dirname(path)
      File.writable?(path)
    end
    module_function :writable?
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fluentd-0.12.8 lib/fluent/plugin/file_util.rb
fluentd-0.12.7 lib/fluent/plugin/file_util.rb
fluentd-0.12.6 lib/fluent/plugin/file_util.rb
fluentd-0.12.5 lib/fluent/plugin/file_util.rb
fluentd-0.12.4 lib/fluent/plugin/file_util.rb
fluentd-0.12.3 lib/fluent/plugin/file_util.rb