diff --git a/modules/conop/src/chemdict_tool.cc b/modules/conop/src/chemdict_tool.cc index 6e5720675c912198e53fb0c0260d3514ecb91004..449d22aac507fbf618e14d233377fe2c096e233e 100644 --- a/modules/conop/src/chemdict_tool.cc +++ b/modules/conop/src/chemdict_tool.cc @@ -72,9 +72,11 @@ int main(int argc, char const *argv[]) filtered_istream.push(istream); io::ChemdictParser cdp(filtered_istream, dialect); conop::CompoundLibPtr compound_lib; - if (!strcmp(argv[1], "create")) { - compound_lib=conop::CompoundLib::Create(argv[3]); - } else if (!strcmp(argv[1], "update")) { + bool in_mem=false; + if (!strncmp(argv[1], "create", 6)) { + compound_lib=conop::CompoundLib::Create(":memory:"); + in_mem=true; + } else if (!strncmp(argv[1], "update", 6)) { compound_lib=conop::CompoundLib::Load(argv[3]); } else { PrintUsage(); @@ -84,10 +86,11 @@ int main(int argc, char const *argv[]) return 0; } assert(compound_lib); - conop::CompoundLibPtr in_mem_lib=compound_lib->Copy(":memory:"); + conop::CompoundLibPtr in_mem_lib=in_mem ? compound_lib : + compound_lib->Copy(":memory:"); compound_lib.reset(); cdp.SetCompoundLib(in_mem_lib); cdp.Parse(); in_mem_lib->Copy(argv[3]); return 0; -} \ No newline at end of file +}