Hi all,
I have my hobby project CloudCV which is a image processing platform in the
cloud environment. For back-end I'm using C++ code which encapsulated into
C++ module used by node.js which serves as front-end for the website.
In general I'm happy with this architecture, but recently I had to make and
algorithm (face detection) that needs some external data for
initialization. This data is stored in the file in XML form. On module load
i'd like to load this file
and initialize C++ algorithm. But I couldn't find a way how to get the
current module directory from the C++ module.
Ideally I'd like to have the following function:
void RegisterModule(Handle<Object> target)
{
std::string currentDirectory = *getModuleDirectory*();
if (initializeFaceDetector(currentDirectory + "my_file_name.xml"))
{
target->Set(String::NewSymbol("detectFaces"),
FunctionTemplate::New(detectFaces)->GetFunction());
}
}
Where *getModuleDirectory* function will return me the full directory where
current C++ module was loaded from.
I tried to use current directory from the OS but it seems to be the path
where the app.js lives.
As a quick fix, a put external files to the root of node.js app, but I feel
uneasy with this solution. What I'd like to achieve is the following
structure:
/cloudcv
- node_modules
- cloudcvbackend
- build
- Release
- cloudcv.node
- my_file_name.xml
So when the app will load cloudcv.node, *getModuleDirectory() *should
return *"/cloudcv/node_modules/cloudcvbackend/build/Release/"*.
Thank in advance,
Eugene.
PS: You can take a look on working example here: http://cloudcv.io/
And sources are here:
https://github.com/BloodAxe/CloudCV
https://github.com/BloodAxe/CloudCVBackend
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.