mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 09:23:03 -04:00
*** empty log message ***
This commit is contained in:
parent
aa85f44e26
commit
5b755a1019
@ -19,7 +19,8 @@ main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
extern char *optarg;
|
extern char *optarg;
|
||||||
extern int optind;
|
extern int optind;
|
||||||
int flag = getopt(argc, argv, "x:c:v");
|
int flag = getopt(argc, argv, "xcvr:");
|
||||||
|
Filename rel_path;
|
||||||
while (flag != EOF) {
|
while (flag != EOF) {
|
||||||
switch (flag) {
|
switch (flag) {
|
||||||
case 'x':
|
case 'x':
|
||||||
@ -30,16 +31,24 @@ main(int argc, char *argv[]) {
|
|||||||
case 'v':
|
case 'v':
|
||||||
verbose = true;
|
verbose = true;
|
||||||
break;
|
break;
|
||||||
|
case 'r':
|
||||||
|
rel_path = optarg;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
cerr << "Unhandled switch: " << flag << endl;
|
cerr << "Unhandled switch: " << flag << endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
flag = getopt(argc, argv, "x:c:v");
|
flag = getopt(argc, argv, "xcvr:");
|
||||||
}
|
}
|
||||||
argc -= (optind - 1);
|
argc -= (optind - 1);
|
||||||
argv += (optind - 1);
|
argv += (optind - 1);
|
||||||
|
|
||||||
Filename dest_file = argv[0];
|
if (argc <= 1) {
|
||||||
|
cerr << "Usage: multify -[x,c|v] <dest_file> <src_file> ..." << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Filename dest_file = argv[1];
|
||||||
dest_file.set_binary();
|
dest_file.set_binary();
|
||||||
|
|
||||||
if (verbose == true) {
|
if (verbose == true) {
|
||||||
@ -52,7 +61,7 @@ main(int argc, char *argv[]) {
|
|||||||
Multifile mfile;
|
Multifile mfile;
|
||||||
|
|
||||||
if (extract == false) {
|
if (extract == false) {
|
||||||
for (int i = 1; i < argc; i++) {
|
for (int i = 2; i < argc; i++) {
|
||||||
Filename in_file = argv[i];
|
Filename in_file = argv[i];
|
||||||
in_file.set_binary();
|
in_file.set_binary();
|
||||||
mfile.add(in_file);
|
mfile.add(in_file);
|
||||||
@ -62,7 +71,7 @@ main(int argc, char *argv[]) {
|
|||||||
cerr << "Failed to write: " << dest_file << endl;
|
cerr << "Failed to write: " << dest_file << endl;
|
||||||
} else {
|
} else {
|
||||||
mfile.read(dest_file);
|
mfile.read(dest_file);
|
||||||
mfile.extract_all();
|
mfile.extract_all(rel_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -233,19 +233,20 @@ read_from_multifile(ifstream &read_stream) {
|
|||||||
// Description: Writes to a individual file
|
// Description: Writes to a individual file
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
bool Multifile::Memfile::
|
bool Multifile::Memfile::
|
||||||
write(void) {
|
write(const Filename &rel_path) {
|
||||||
ofstream write_stream;
|
ofstream write_stream;
|
||||||
_name.set_binary();
|
Filename name = rel_path.get_fullpath() + _name.get_fullpath();
|
||||||
_name.make_dir();
|
name.set_binary();
|
||||||
if (!_name.open_write(write_stream)) {
|
name.make_dir();
|
||||||
|
if (!name.open_write(write_stream)) {
|
||||||
express_cat.error()
|
express_cat.error()
|
||||||
<< "Multifile::Memfile::write() - Failed to open output file: "
|
<< "Multifile::Memfile::write() - Failed to open output file: "
|
||||||
<< _name << endl;
|
<< name << endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
express_cat.debug()
|
express_cat.debug()
|
||||||
<< "Writing to file: " << _name << endl;
|
<< "Writing to file: " << name << endl;
|
||||||
|
|
||||||
write_stream.write(_buffer, _buffer_length);
|
write_stream.write(_buffer, _buffer_length);
|
||||||
return true;
|
return true;
|
||||||
@ -607,11 +608,11 @@ reset(void) {
|
|||||||
// Description:
|
// Description:
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
bool Multifile::
|
bool Multifile::
|
||||||
extract(const Filename &name) {
|
extract(const Filename &name, const Filename &rel_path) {
|
||||||
MemfileList::iterator found;
|
MemfileList::iterator found;
|
||||||
found = find_if(_files.begin(), _files.end(), MemfileMatch(name));
|
found = find_if(_files.begin(), _files.end(), MemfileMatch(name));
|
||||||
if (found != _files.end()) {
|
if (found != _files.end()) {
|
||||||
(*found)->write();
|
(*found)->write(rel_path);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -623,11 +624,11 @@ extract(const Filename &name) {
|
|||||||
// Description:
|
// Description:
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void Multifile::
|
void Multifile::
|
||||||
extract_all(void) {
|
extract_all(const Filename &rel_path) {
|
||||||
express_cat.debug()
|
express_cat.debug()
|
||||||
<< "Multifile::extract_all() - Extracting all files" << endl;
|
<< "Multifile::extract_all() - Extracting all files" << endl;
|
||||||
|
|
||||||
MemfileList::iterator i;
|
MemfileList::iterator i;
|
||||||
for (i = _files.begin(); i != _files.end(); ++i)
|
for (i = _files.begin(); i != _files.end(); ++i)
|
||||||
(*i)->write();
|
(*i)->write(rel_path);
|
||||||
}
|
}
|
||||||
|
@ -45,8 +45,8 @@ public:
|
|||||||
bool write(Filename name);
|
bool write(Filename name);
|
||||||
bool write(char *&start, int &size);
|
bool write(char *&start, int &size);
|
||||||
bool write_extract(char *&start, int &size);
|
bool write_extract(char *&start, int &size);
|
||||||
bool extract(const Filename &name);
|
bool extract(const Filename &name, const Filename &rel_path = "");
|
||||||
void extract_all(void);
|
void extract_all(const Filename &rel_path = "");
|
||||||
|
|
||||||
void reset(void);
|
void reset(void);
|
||||||
bool parse_header(char *&start, int &size);
|
bool parse_header(char *&start, int &size);
|
||||||
@ -64,7 +64,7 @@ private:
|
|||||||
|
|
||||||
bool read(const Filename &name);
|
bool read(const Filename &name);
|
||||||
bool read_from_multifile(ifstream &read_stream);
|
bool read_from_multifile(ifstream &read_stream);
|
||||||
bool write(void);
|
bool write(const Filename &rel_path);
|
||||||
void write_to_multifile(ofstream &write_stream);
|
void write_to_multifile(ofstream &write_stream);
|
||||||
bool write(char *&start, int &size);
|
bool write(char *&start, int &size);
|
||||||
void reset(void);
|
void reset(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user