Question:
Are there any known issues with CkDirTree (C++) on Centos 7? I'm attempting to use Chilkat in the same fashion I always had before (same codebase), but I'm now failing on the BeginIterate() step when using CkDirTree. No error code or text is returned (even with VerboseLogging enabled), so I'm not entirely sure how to debug it.
I've verified the directory exists and that permissions are such that I should be able to peruse the directory. strace didn't reveal any obvious answers either.
I'm not aware of anything. Are you using the 64-bit or 32-bit lib? I can add information to the LastErrorText to help (and post a pre-release download)..
The 32-bit and 64-bit "Linux" downloads at http://www.chilkatsoft.com/chilkatLinux.asp are for RHEL, CentOS, etc. The 32-bit RHEL4 download is just for an old version of RHEL.
There should be no need for you to use it. Just use the 64-bit Linux build on CentOS.
I looked at the internals, and I think the only information needed is the value of the BaseDir property. Verify that you're setting it to what you expect..
for example:
dirTree.put_BaseDir("/something/abc/123");or.. if you pass a relative path to put_BaseDir, then make sure you know the actual value of your current working directory. If it's not what you expect...
Here's my comparable results on a Centos 7 64-bit machine and a Xubuntu 16.04 32-bit machine (as mentioned before, lastErrorText doesn't provide any useful details on the Centos box...I just noticed I forgot to add that to my test program): XUBUNTU 16.04 LTS, 32-bit
root@alpha(10.1.10.19) : ~/test_dir $ cat test.cpp
include "CkDirTree.h"
include <stdio.h>
int main() {
CkDirTree dirtree;
CkString base_dir;
dirtree.get_BaseDir(base_dir);
dirtree.put_Recurse(false);
printf("basedir is %s\n",base_dir.getString());
if (dirtree.BeginIterate() == false) {
printf("failure\n");
}
while (dirtree.get_DoneIterating() != true) {
const char *rel_path;
rel_path = dirtree.relativePath();
printf("file: %s\n",rel_path);
if (dirtree.AdvancePosition() == false) {
if (dirtree.get_DoneIterating() != true) {
printf("failure2\n");
}
}
}
return 0;
}
root@alpha(10.1.10.19) : ~/test_dir $ g++ -m32 test.cpp -lchilkat-9.5.0 -lpthread -I./chilkat/chilkat-9.5.0-x86-linux-gcc/include -L.
root@alpha(10.1.10.19) : ~/test_dir $ ./a.out
basedir is /root/test_dir
file: a.out
file: .
file: libchilkat-9.5.0.a
file: chilkat
file: test.cpp
file: ..
file: testpackage.tar
root@alpha(10.1.10.19) : ~/test_dir $ ls
a.out chilkat libchilkat-9.5.0.a test.cpp testpackage.tar
root@alpha(10.1.10.19) : ~/test_dir $
root@localhost(10.1.0.106) : ~/test_dir $ cat test.cpp
#include "CkDirTree.h"
#include <stdio.h>
int main() {
CkDirTree dirtree;
CkString base_dir;
dirtree.get_BaseDir(base_dir);
dirtree.put_Recurse(false);
printf("basedir is %s\n",base_dir.getString());
if (dirtree.BeginIterate() == false) {
printf("failure\n");
}
while (dirtree.get_DoneIterating() != true) {
const char *rel_path;
rel_path = dirtree.relativePath();
printf("file: %s\n",rel_path);
if (dirtree.AdvancePosition() == false) {
if (dirtree.get_DoneIterating() != true) {
printf("failure2\n");
}
}
}
return 0;
}
root@localhost(10.1.0.106) : ~/test_dir
$ g++ -m32 test.cpp -lchilkat-9.5.0 -lpthread -I./chilkat/chilkat-9.5.0-x86-linux-gcc/include/ -L.
root@localhost(10.1.0.106) : ~/test_dir $ ./a.out
basedir is /root/test_dir
failure
root@localhost(10.1.0.106) : ~/test_dir $ ls
a.out chilkat libchilkat-9.5.0.a test.cpp testpackage.tar
root@localhost(10.1.0.106) : ~/test_dir $
Thanks, I'll give it a test..