Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Dec 6th, 2005, 5:54 PM   #1
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 2,075
Rep Power: 6 Sane will become famous soon enough
Send a message via MSN to Sane
A py2exe solution

It hasn't been much of a problem, I'm guessing mainly because people have found a simple solution around it. But instead ColdDeath coded a solution for me.

The problem was when py2exe compiles it's programs, it outputs like so:

Your Directory
- build
- dist
- - program
- - - program.exe

Which means every client will need to open up "Your Directory/dist/program/program.exe". Not very convenient.

With this simple C++ program at: http://1v7.com/drsane/py2exe_solution.zip,
#include <iostream>
#include <fstream>
#include <stdlib.h>

using namespace std;

int main(int argc, char **argv)
{
        char direct_ini_contents[1024];         /* declare file string */
        char cwd[1024];                         /* declare cwd string */
        char fileName[1024];                    /* declare filename string */

        ifstream the_file ("redirect.ini");     /* open file */
        the_file >> direct_ini_contents;        /* send contents of file to string */
        the_file.close();                       /* close file object */

        cwd[0] = system("cd");                  /* set cwd to the cwd string */
        sprintf(fileName, "START %s%s",  cwd, direct_ini_contents);

        system(fileName);                       /* run file */

        return 0;
}
It reads the contents of "redirect.ini", appends it to the current working directory, and opens that file.

So in redirect.ini you can put "program/program.exe", then place the exe in the main folder. When the user opens this exe, it'll actually open up the exe located inside the redirect.ini.

Not sure if you need it as well, but if so, thank ColdDeath!
Sane is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:05 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC