It's working! Hooray!
This commit is contained in:
parent
a3496fe02e
commit
0b7d72ebdd
|
@ -189,11 +189,11 @@ if [ "x$ans" = "x1" -o "x$ans" = "x" ]; then
|
|||
echo " * Standalone version"
|
||||
rm -f Rules.make
|
||||
ln -sf Rules.make.standalone Rules.make
|
||||
rm -f sdl-instead
|
||||
ln -sf src/sdl-instead/sdl-instead sdl-instead
|
||||
rm -f steed
|
||||
ln -sf src/sdl-instead/sdl-instead steed
|
||||
echo "Ok. We are ready to build. Use these commands:"
|
||||
echo " \$ make"
|
||||
echo " \$ ./sdl-instead"
|
||||
echo " \$ ./steed"
|
||||
elif [ "x$ans" = "x2" ]; then
|
||||
echo -n "Enter prefix path [/usr/local]: "
|
||||
read ans
|
||||
|
@ -223,7 +223,7 @@ elif [ "x$ans" = "x2" ]; then
|
|||
echo "Ok. We are ready to build and install. Use these commands:"
|
||||
echo " \$ make"
|
||||
echo " \$ sudo make install"
|
||||
echo " \$ sdl-instead"
|
||||
echo " \$ steed"
|
||||
else
|
||||
echo "Huh!!! Wrong answer."
|
||||
exit 1
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
src/sdl-instead/sdl-instead
|
|
@ -21,12 +21,10 @@ sdl-instead$(EXE): $(OBJ) $(RESOURCES)
|
|||
|
||||
install:
|
||||
$(INSTALLD) $(BIN)
|
||||
$(INSTALLB) sdl-instead$(EXE) $(BIN)/sdl-instead$(EXE)
|
||||
$(LN) sdl-instead$(EXE) $(BIN)/instead$(EXE)
|
||||
$(INSTALLB) sdl-instead$(EXE) $(BIN)/steed$(EXE)
|
||||
|
||||
uninstall:
|
||||
$(RM) $(BIN)/sdl-instead$(EXE)
|
||||
$(RM) $(BIN)/instead$(EXE)
|
||||
$(RM) $(BIN)/steed$(EXE)
|
||||
|
||||
clean:
|
||||
$(RM) -f *.o sdl-instead$(EXE)
|
||||
|
|
|
@ -46,21 +46,64 @@ char *start_idf_sw = NULL;
|
|||
extern int unpack(const char *zipfilename, const char *where);
|
||||
extern char zip_game_dirname[];
|
||||
|
||||
static void
|
||||
get_url (const char *url, const char *outfile)
|
||||
{
|
||||
const char *name;
|
||||
static SoupSession *session;
|
||||
SoupMessage *msg;
|
||||
const char *header;
|
||||
|
||||
session = soup_session_sync_new_with_options (
|
||||
SOUP_SESSION_SSL_CA_FILE, NULL,
|
||||
SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_CONTENT_DECODER,
|
||||
SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_COOKIE_JAR,
|
||||
SOUP_SESSION_USER_AGENT, "get ",
|
||||
SOUP_SESSION_ACCEPT_LANGUAGE_AUTO, TRUE,
|
||||
NULL);
|
||||
|
||||
|
||||
msg = soup_message_new (SOUP_METHOD_GET, url);
|
||||
soup_message_set_flags (msg, SOUP_MESSAGE_NO_REDIRECT);
|
||||
|
||||
soup_session_send_message (session, msg);
|
||||
|
||||
name = soup_message_get_uri (msg)->path;
|
||||
|
||||
if (SOUP_STATUS_IS_REDIRECTION (msg->status_code)) {
|
||||
header = soup_message_headers_get_one (msg->response_headers,
|
||||
"Location");
|
||||
if (header) {
|
||||
SoupURI *uri;
|
||||
char *uri_string;
|
||||
uri = soup_uri_new_with_base (soup_message_get_uri (msg), header);
|
||||
uri_string = soup_uri_to_string (uri, FALSE);
|
||||
get_url (uri_string,outfile);
|
||||
g_free (uri_string);
|
||||
soup_uri_free (uri);
|
||||
}
|
||||
} else if (SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) {
|
||||
//FILE * temp = fopen(outfile,"w");
|
||||
//fwrite (msg->response_body->data, 1, msg->response_body->length, temp);
|
||||
int fd = open (outfile, O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
write (fd, msg->response_body->data, msg->response_body->length);
|
||||
close (fd);
|
||||
//fclose(temp);
|
||||
}
|
||||
}
|
||||
|
||||
static int setup_zip(const char *file, char *p)
|
||||
{
|
||||
if (!p)
|
||||
return -1;
|
||||
if (!p) return -1;
|
||||
#ifdef _USE_HTTP
|
||||
SoupSession * soup_session = soup_session_sync_new ();
|
||||
SoupMessage * msg;
|
||||
int fd;
|
||||
if (soup_uri_new (file)){
|
||||
msg = soup_message_new ("GET", file);
|
||||
if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) return -2;
|
||||
sprintf(file,"%s/temp_download.zip",p);
|
||||
fd = open (file, O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
write (fd, msg->response_body, msg->response_body->length);
|
||||
SoupURI * parsed = soup_uri_new (file);
|
||||
if (parsed){
|
||||
char * outfile = game_tmp_path();
|
||||
strcat(outfile,"/temp_download.zip");
|
||||
get_url(file,outfile);
|
||||
file = outfile;
|
||||
}
|
||||
soup_uri_free (parsed);
|
||||
#endif
|
||||
fprintf(stderr,"Trying to install: %s\n", file);
|
||||
if (unpack(file, p)) {
|
||||
|
|
Loading…
Reference in a new issue