[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi] ihs_proddata.cpp assert
From: |
Evgeniy Tarassov |
Subject: |
[lmi] ihs_proddata.cpp assert |
Date: |
Tue, 28 Mar 2006 11:38:45 +0200 |
Hello, Greg!
I've noticed that (ihs_proddata.cpp) TProductData::Init method
enforces a leaf-only filenames while other classes don't, and then it
adds default data directory path to the filename. As a consequence
.pol could be read only from that default data directory. I guess it
wasn't intentional. Is it correct?
Below is a little patch that could change that behaviour allowing the
calling code to pass filename with directory information (in that case
filename isn't changed) or just a filename (in which case we
AddDataDir(filename)).
Thank you in advance!
--
ET
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Index: ihs_proddata.cpp
===================================================================
RCS file: /sources/lmi/lmi/ihs_proddata.cpp,v
retrieving revision 1.9
diff -u -r1.9 ihs_proddata.cpp
--- ihs_proddata.cpp 12 Sep 2005 01:32:19 -0000 1.9
+++ ihs_proddata.cpp 28 Mar 2006 09:24:36 -0000
@@ -63,9 +63,15 @@
void TProductData::Init(std::string const& a_Filename)
{
fs::path path(a_Filename);
- LMI_ASSERT(a_Filename == path.leaf());
path = fs::change_extension(path, ".pol");
- Read(AddDataDir(path.string()));
+ std::string filename = path.string();
+ // if a_Filename is a filename only without directory information
+ // then add default data directory path
+ if( path.string() == path.leaf() && path.root_path().string().empty() )
+ { // no directory information in a_Filename
+ filename = AddDataDir( filename );
+ }
+ Read(filename);
}
//============================================================================
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
- [lmi] ihs_proddata.cpp assert,
Evgeniy Tarassov <=