    # File lib/yard/serializers/file_system_serializer.rb, line 48
          def serialized_path(object)
            return object if object.is_a?(String)

            if object.is_a?(CodeObjects::ExtraFileObject)
              fspath = ['file.' + object.name + (extension.empty? ? '' : ".#{extension}")]
            else
              objname = object != YARD::Registry.root ? object.name.to_s : "top-level-namespace"
              objname += '_' + object.scope.to_s[0,1] if object.is_a?(CodeObjects::MethodObject)
              fspath = [objname + (extension.empty? ? '' : ".#{extension}")]
              if object.namespace && object.namespace.path != ""
                fspath.unshift(*object.namespace.path.split(CodeObjects::NSEP))
              end
            end

            # Don't change the filenames, it just makes it more complicated
            # to figure out the original name.
            #fspath.map! do |p|
            #  p.gsub(/([a-z])([A-Z])/, '\1_\2').downcase
            #end

            # Remove special chars from filenames.
            # Windows disallows \ / : * ? " < > | but we will just remove any
            # non alphanumeric (plus period, underscore and dash).
            fspath.map! do |p|
              p.gsub(/[^\w\.-]/) do |x|
                encoded = '_'

                x.each_byte { |b| encoded << ("%X" % b) }
                encoded
              end
            end

            File.join(fspath)
          end