2 * Copyright 2011, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
7 #include "PackageWritingUtils.h"
14 #include <package/hpkg/HPKGDefs.h>
16 #include <AutoDeleter.h>
20 add_current_directory_entries(BPackageWriter
& packageWriter
,
21 BPackageWriterListener
& listener
, bool skipPackageInfo
)
23 // open the current directory
24 DIR* dir
= opendir(".");
26 listener
.PrintError("Error: Failed to opendir '.': %s\n",
30 CObjectDeleter
<DIR, int> dirCloser(dir
, &closedir
);
32 while (dirent
* entry
= readdir(dir
)) {
34 if (strcmp(entry
->d_name
, ".") == 0 || strcmp(entry
->d_name
, "..") == 0)
37 // skip the .PackageInfo, if requested
39 && strcmp(entry
->d_name
,
40 BPackageKit::BHPKG::B_HPKG_PACKAGE_INFO_FILE_NAME
) == 0) {
44 status_t error
= packageWriter
.AddEntry(entry
->d_name
);