added extension for file attributes. Fixes problem when sharing Application bundles on OSX or hidden files on windows

This commit is contained in:
Arvid Norberg
2009-01-11 22:27:43 +00:00
parent de9286a760
commit 43e69cd316
11 changed files with 186 additions and 44 deletions

View File

@@ -117,9 +117,16 @@ file structure. Its synopsis::
bool is_valid() const;
enum flags_t
{
pad_file = 1,
attribute_hidden = 2,
attribute_executable = 4
};
void add_file(file_entry const& e);
void add_file(fs::path const& p, size_type size, bool pad_file = false);
void add_file(fs::wpath const& p, size_type size, bool pad_file = false);
void add_file(fs::path const& p, size_type size, int flags = 0);
void add_file(fs::wpath const& p, size_type size, int flags = 0);
void rename_file(int index, std::string const& new_filename);
void rename_file(int index, std::wstring const& new_filename);
@@ -152,6 +159,23 @@ file structure. Its synopsis::
void swap(file_storage& ti);
}
add_file()
----------
::
void add_file(file_entry const& e);
void add_file(fs::path const& p, size_type size, int flags = 0);
void add_file(fs::wpath const& p, size_type size, int flags = 0);
Adds a file to the file storage. The ``flags`` argument sets attributes on the file.
The file attributes is an extension and may not work in all bittorrent clients.
The possible arreibutes are::
pad_file
attribute_hidden
attribute_executable
create_torrent
==============

View File

@@ -1378,7 +1378,9 @@ iterators with the type ``file_entry``.
size_type offset;
size_type size;
size_type file_base;
boost::shared_ptr<const boost::filesystem::path> orig_path;
bool pad_file:1;
bool hidden_attribute:1;
bool executable_attribute:1;
};
The ``path`` is the full (relative) path of each file. i.e. if it is a multi-file
@@ -1396,13 +1398,10 @@ the ``file_base`` should be set to an offset so that the different regions do
not overlap. This is used when mapping "unselected" files into a so-called part
file.
``orig_path`` is set to 0 in case the path element is an exact copy of that
found in the metadata. In case the path in the original metadata was
incorrectly encoded, and had to be fixed in order to be acceptable utf-8,
the original string is preserved in ``orig_path``. The reason to keep it
is to be able to reproduce the info-section exactly, with the correct
info-hash.
``pad_file`` is set to true for files that are not part of the data of the torrent.
They are just there to make sure the next file is aligned to a particular byte offset
or piece boundry. These files should typically be hidden from an end user. They are
not written to disk.
num_files() file_at()