if (filename)
{
- ui->builder = tr_metaInfoBuilderCreate(filename);
+ ui->builder = tr_metaInfoBuilderCreate(filename, false);
}
updatePiecesLabel(ui);
/* create a single input file */
input_file = tr_buildPath(sandbox, "test.XXXXXX", NULL);
libtest_create_tmpfile_with_contents(input_file, payload, payloadSize);
- builder = tr_metaInfoBuilderCreate(input_file);
+ builder = tr_metaInfoBuilderCreate(input_file, false);
check_str(builder->top, ==, input_file);
check_int(builder->fileCount, ==, 1);
check_str(builder->files[0].filename, ==, input_file);
libttest_sync();
/* init the builder */
- builder = tr_metaInfoBuilderCreate(top);
+ builder = tr_metaInfoBuilderCreate(top, false);
check(!builder->abortFlag);
check_str(builder->top, ==, top);
check_int(builder->fileCount, ==, payloadCount);
struct FileList* next;
};
-static struct FileList* getFiles(char const* dir, char const* base, struct FileList* list)
+static struct FileList* getFiles(char const* dir, char const* base, int readDirFlags, struct FileList* list)
{
if (dir == NULL || base == NULL)
{
{
char const* name;
- while ((name = tr_sys_dir_read_name(odir, TR_SYS_DIR_READ_SKIP_HIDDEN, NULL)) != NULL)
+ while ((name = tr_sys_dir_read_name(odir, readDirFlags, NULL)) != NULL)
{
- list = getFiles(buf, name, list);
+ list = getFiles(buf, name, readDirFlags, list);
}
tr_sys_dir_close(odir, NULL);
return evutil_ascii_strcasecmp(a->filename, b->filename);
}
-tr_metainfo_builder* tr_metaInfoBuilderCreate(char const* topFileArg)
+tr_metainfo_builder* tr_metaInfoBuilderCreate(char const* topFileArg, bool includeHiddenFiles)
{
char* const real_top = tr_sys_path_resolve(topFileArg, NULL);
{
char* dir = tr_sys_path_dirname(ret->top, NULL);
char* base = tr_sys_path_basename(ret->top, NULL);
- files = getFiles(dir, base, NULL);
+ int const readDirFlags = includeHiddenFiles ? 0 : TR_SYS_DIR_READ_SKIP_HIDDEN;
+
+ files = getFiles(dir, base, readDirFlags, NULL);
+
tr_free(base);
tr_free(dir);
}
}
tr_metainfo_builder;
-tr_metainfo_builder* tr_metaInfoBuilderCreate(char const* topFile);
+tr_metainfo_builder* tr_metaInfoBuilderCreate(char const* topFile, bool includeHiddenFiles);
/**
* Call this before tr_makeMetaInfo() to override the builder.pieceSize
if (!creatorWindowControllerSet) {
creatorWindowControllerSet = [NSMutableSet set];
}
-
+
fStarted = NO;
fPath = path;
- fInfo = tr_metaInfoBuilderCreate([[fPath path] UTF8String]);
+ fInfo = tr_metaInfoBuilderCreate([[fPath path] UTF8String], false);
if (fInfo->fileCount == 0)
{
if (!tr_urlIsValidTracker([fTrackers[i] UTF8String]))
[fTrackers removeObjectAtIndex: i];
}
-
+
[creatorWindowControllerSet addObject:self];
}
return self;
if (!filename.isEmpty())
{
- myBuilder.reset(tr_metaInfoBuilderCreate(filename.toUtf8().constData()));
+ myBuilder.reset(tr_metaInfoBuilderCreate(filename.toUtf8().constData(), false));
}
QString text;
static uint32_t const KiB = 1024;
static tr_tracker_info trackers[MAX_TRACKERS];
static int trackerCount = 0;
+static bool includeHiddenFiles = false;
static bool isPrivate = false;
static bool showVersion = false;
static char const* comment = NULL;
{ 's', "piecesize", "Set how many KiB each piece should be, overriding the preferred default", "s", 1, "<size in KiB>" },
{ 'c', "comment", "Add a comment", "c", 1, "<comment>" },
{ 't', "tracker", "Add a tracker's announce URL", "t", 1, "<url>" },
+ { 'H', "include-hidden", "Include hidden files and directories into the torrent", "H", 0, NULL },
{ 'V', "version", "Show version number and exit", "V", 0, NULL },
{ 0, NULL, NULL, NULL, 0, NULL }
};
isPrivate = true;
break;
+ case 'H':
+ includeHiddenFiles = true;
+ break;
+
case 'o':
outfile = optarg;
break;
printf("Creating torrent \"%s\" ...", outfile);
fflush(stdout);
- b = tr_metaInfoBuilderCreate(infile);
+ b = tr_metaInfoBuilderCreate(infile, includeHiddenFiles);
if (b == NULL)
{
.Nm
.Op Fl h
.Op Fl p
+.Op Fl H
.Op Fl o Ar file
.Op Fl c Ar comment
.Op Fl t Ar tracker
to the .torrent. Most torrents will have at least one
.Ar announce URL.
To add more than one, use this option multiple times.
+.It Fl H Fl -include-hidden
+Include hidden files and directories into the torrent. The notion of "hidden"
+varies between platforms; on *NIX systems these are the files and directories
+having name starting with a dot (".") character, on Windows they will have a
+corresponding attribute set instead.
.El
.Sh AUTHORS
.An -nosplit