- /* On Windows copy the wrapper to the program directory.
- */
- os::String tmpWrapper(argv[0]);
- tmpWrapper.trimFilename();
- tmpWrapper.join(wrapperFilename);
-
- if (verbose) {
- std::cerr << wrapperPath << " -> " << tmpWrapper << "\n";
- }
-
- if (tmpWrapper.exists()) {
- std::cerr << "error: not overwriting " << tmpWrapper << "\n";
- return 1;
- }
-
- if (!os::copyFile(wrapperPath, tmpWrapper, false)) {
- std::cerr << "error: failed to copy " << wrapperPath << " into " << tmpWrapper << "\n";
- return 1;
+ if (useInject) {
+ args.push_back("inject");
+ args.push_back(wrapperPath);
+ } else {
+ /* On Windows copy the wrapper to the program directory.
+ */
+ if (!copyWrapper(wrapperPath, argv[0], verbose)) {
+ goto exit;
+ }