Can't find file or directory, even though it is present

Greetings all,

I have a problem trying to run a program that I have found on Github, whole project is here:
https://github.com/guillaumeportails/OSMGL

Error happens at statement: "OSM.LoadText()"
The input is location of a file, e.g.:
OSM.LoadText("monaco-latest.osm.bz")
The error I get is "no such file or directory" and debugger gives SIGSEGV segmentation fault. Obviously, the file is present at the right location, this has worked for me before on other occasions and I have also tried with both, relative and absolute paths.

I am using CodeBlocks IDE with MinGW on a Win 7 64 bit machine. Does anyone have an idea why this fails for me? These functions seem relevant in the problem:


LoadText
1
2
3
4
5
6
void OSMData::LoadText (const char *filename)
{
  LatLonBox clip;
  clip.open();                  // Pas de restriction
  LoadText (filename, clip);
}




LoadText (two input arguments):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
void OSMData::LoadText (const char *filename, LatLonBox &clip)
{
  IByteFileReader *f = NewByteFileReader (filename);
  if (f == NULL) throw "nofile";

  m_parser = XML_ParserCreate (NULL);   // NB: Defaut OSM encoding is UTF-8

  XML_SetUserData (m_parser, this);
  XML_SetElementHandler (m_parser, C_startElementHandler, C_endElementHandler);

  // Les compteurs de ne pas rinces : ce LoadText est en fait un Append,
  // possible car l'espace des ID est commun a tous les OSM
  m_inway = false;
  m_inrel = false;
  m_badrefwn = 0;
  m_badrefr  = 0;
  m_loadbound.close();  // So that extend() works

  for (;;)
  {
    XML_Status status;

    // Obtenir un bloc a parser
    f->Async_Feed();

    try
    {
      status = XML_Parse(m_parser, f->buffer, f->fill, f->fill == 0);
    }
    catch (...)
    {
      printf ("EXC line %d  node=%d way=%d relations=%d\n",
            (int) XML_GetCurrentLineNumber (m_parser),
            m_nodes.size(), m_ways.size(), m_relations.size());
      delete f;
      throw;
    }
    if (! status)
    {                           // Parse error
      delete f;
      throw "syntaxError";
    }

    if (f->fill == 0) break;    // EOF
  }

  delete f;
}




NewByteFileReader:
1
2
3
4
5
6
7
8
9
10
IByteFileReader *NewByteFileReader (const char *filename)
{
  int n = strlen(filename);     // ! Ne marcherait pas en UTF-8

  while ((n >= 0) && (filename[n] != '.')) --n;

  if (! strcmp(filename+n, ".bz2")) return new Bz2Reader (filename);

  return new PlainReader (filename);
}


Thank you very much and kind regards,
T
Last edited on
Topic archived. No new replies allowed.