Skip to content

Add a new file to a package? #5

@UltraEngine

Description

@UltraEngine

Hi, I am trying to figure out how to add a new file to a package. hlPackageOpenFile() returns 0 if the file does not already exist:

int WriteStream(Package* pak, wchar_t* path, void* data, uint64_t sz)
{
	hlBindPackage(pak->hlpak);
	auto s = String(path);
	if (not hlPackageOpenFile(s.c_str(), HL_MODE_WRITE)) return 0;
	auto root = hlPackageGetRoot();
	auto item = hlFolderGetItemByPath(root, s.c_str(), HL_FIND_ALL);
	HLStream* stream;
	hlPackageCreateStream(item, &stream);
	hlStreamWrite(stream, data, sz);
	hlStreamClose(stream);
	pak->modified = true;
	return 1;
}

Is it possible to use HLLib to add a new file to the package?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions