don't include symlink info by default in torrents
This commit is contained in:
parent
3e77b161c2
commit
c9f7ba495f
|
@ -217,7 +217,12 @@ The ``create_torrent`` class has the following synopsis::
|
|||
|
||||
struct create_torrent
|
||||
{
|
||||
enum { optimize = 1, merkle = 2, modification_time = 4 };
|
||||
enum {
|
||||
optimize = 1
|
||||
, merkle = 2
|
||||
, modification_time = 4
|
||||
, symlink = 8
|
||||
};
|
||||
create_torrent(file_storage& fs, int piece_size = 0, int pad_size_limit = -1, int flags = optimize);
|
||||
create_torrent(torrent_info const& ti);
|
||||
|
||||
|
@ -244,7 +249,12 @@ create_torrent()
|
|||
|
||||
::
|
||||
|
||||
enum { optimize = 1, merkle = 2, modification_time = 4 };
|
||||
enum {
|
||||
optimize = 1
|
||||
, merkle = 2
|
||||
, modification_time = 4
|
||||
, symlink = 8
|
||||
};
|
||||
create_torrent(file_storage& fs, int piece_size = 0, int pad_size_limit = -1, int flags = optimize);
|
||||
create_torrent(torrent_info const& ti);
|
||||
|
||||
|
@ -286,6 +296,13 @@ modification_time
|
|||
with this option enabled, you would get different info-hashes for the
|
||||
files.
|
||||
|
||||
symlink
|
||||
If this flag is defined, files that are symlinks get a symlink attribute
|
||||
set on them. The file data will still be the same, the symlink will always
|
||||
be followed when opening the file, but the file list will include the path
|
||||
of the symlink so that the original directory structure can be reproduced
|
||||
on the downloading side.
|
||||
|
||||
generate()
|
||||
----------
|
||||
|
||||
|
|
|
@ -66,7 +66,12 @@ namespace libtorrent
|
|||
|
||||
struct TORRENT_EXPORT create_torrent
|
||||
{
|
||||
enum { optimize = 1, merkle = 2, modification_time = 4 };
|
||||
enum {
|
||||
optimize = 1
|
||||
, merkle = 2
|
||||
, modification_time = 4
|
||||
, symlinks = 8
|
||||
};
|
||||
|
||||
create_torrent(file_storage& fs, int piece_size = 0
|
||||
, int pad_file_limit = -1, int flags = optimize);
|
||||
|
@ -143,6 +148,11 @@ namespace libtorrent
|
|||
// if set, include the 'mtime' modification time in the
|
||||
// torrent file
|
||||
bool m_include_mtime:1;
|
||||
|
||||
// if set, symbolic links are declared as such in
|
||||
// the torrent file. The full data of the pointed-to
|
||||
// file is still included
|
||||
bool m_include_symlinks:1;
|
||||
};
|
||||
|
||||
namespace detail
|
||||
|
|
|
@ -114,6 +114,7 @@ namespace libtorrent
|
|||
, m_private(false)
|
||||
, m_merkle_torrent(flags & merkle)
|
||||
, m_include_mtime(flags & modification_time)
|
||||
, m_include_symlinks(flags & symlinks)
|
||||
{
|
||||
TORRENT_ASSERT(fs.num_files() > 0);
|
||||
|
||||
|
@ -166,6 +167,8 @@ namespace libtorrent
|
|||
, m_multifile(ti.num_files() > 1)
|
||||
, m_private(ti.priv())
|
||||
, m_merkle_torrent(ti.is_merkle_torrent())
|
||||
, m_include_mtime(false)
|
||||
, m_include_symlinks(false)
|
||||
{
|
||||
TORRENT_ASSERT(ti.is_valid());
|
||||
if (ti.creation_date()) m_creation_date = *ti.creation_date();
|
||||
|
@ -279,10 +282,7 @@ namespace libtorrent
|
|||
|
||||
if (!m_multifile)
|
||||
{
|
||||
if (m_include_mtime)
|
||||
{
|
||||
info["mtime"] = m_files.at(0).mtime;
|
||||
}
|
||||
if (m_include_mtime) info["mtime"] = m_files.at(0).mtime;
|
||||
info["length"] = m_files.at(0).size;
|
||||
if (m_files.at(0).pad_file
|
||||
|| m_files.at(0).hidden_attribute
|
||||
|
@ -293,9 +293,9 @@ namespace libtorrent
|
|||
if (m_files.at(0).pad_file) attr += 'p';
|
||||
if (m_files.at(0).hidden_attribute) attr += 'h';
|
||||
if (m_files.at(0).executable_attribute) attr += 'x';
|
||||
if (m_files.at(0).symlink_attribute) attr += 'l';
|
||||
if (m_include_symlinks && m_files.at(0).symlink_attribute) attr += 'l';
|
||||
}
|
||||
if (m_files.at(0).symlink_attribute)
|
||||
if (m_include_symlinks && m_files.at(0).symlink_attribute)
|
||||
{
|
||||
entry& sympath_e = info["symlink path"];
|
||||
|
||||
|
@ -315,10 +315,7 @@ namespace libtorrent
|
|||
{
|
||||
files.list().push_back(entry());
|
||||
entry& file_e = files.list().back();
|
||||
if (m_include_mtime)
|
||||
{
|
||||
file_e["mtime"] = i->mtime;
|
||||
}
|
||||
if (m_include_mtime) file_e["mtime"] = i->mtime;
|
||||
file_e["length"] = i->size;
|
||||
entry& path_e = file_e["path"];
|
||||
|
||||
|
@ -340,9 +337,9 @@ namespace libtorrent
|
|||
if (i->pad_file) attr += 'p';
|
||||
if (i->hidden_attribute) attr += 'h';
|
||||
if (i->executable_attribute) attr += 'x';
|
||||
if (i->symlink_attribute) attr += 'l';
|
||||
if (m_include_symlinks && i->symlink_attribute) attr += 'l';
|
||||
}
|
||||
if (i->symlink_attribute)
|
||||
if (m_include_symlinks && i->symlink_attribute)
|
||||
{
|
||||
entry& sympath_e = file_e["symlink path"];
|
||||
|
||||
|
|
Loading…
Reference in New Issue