VirtualBox

Changeset 16684 in vbox for trunk


Ignore:
Timestamp:
Feb 11, 2009 4:47:53 PM (16 years ago)
Author:
vboxsync
Message:

cbinding: Added the functions to get and set the environment variables.

Location:
trunk/src/VBox/Main/cbinding
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/cbinding/VBoxXPCOMC.cpp

    r16534 r16684  
    2626
    2727#include <iprt/string.h>
     28#include <iprt/env.h>
    2829#include <VBox/log.h>
    2930
    3031#include "VirtualBox_XPCOM.h"
     32#include "VBox/com/com.h"
    3133#include "cbinding.h"
    3234
     
    7173}
    7274
     75VBOXXPCOMC_DECL(int)
     76VBoxSetEnv(const char *pszVar, const char *pszValue)
     77{
     78    return RTEnvSet(pszVar, pszValue);
     79}
     80
     81VBOXXPCOMC_DECL(const char*)
     82VBoxGetEnv(const char *pszVar)
     83{
     84    return RTEnvGet(pszVar);
     85}
     86
    7387VBOXXPCOMC_DECL(void)
    7488VBoxComInitialize(IVirtualBox **virtualBox, ISession **session)
     
    8296    Ivirtualbox = *virtualBox;
    8397
    84     rc = NS_InitXPCOM2(&serviceManager, nsnull, nsnull);
     98    rc = com::Initialize();
    8599    if (NS_FAILED(rc))
    86100    {
     
    136150    if (serviceManager)
    137151        NS_RELEASE(serviceManager); // decrement refcount
    138     NS_ShutdownXPCOM(nsnull);
     152    com::Shutdown();
    139153    Log(("Cbinding: Cleaned up the created IVirtualBox and ISession Objects.\n"));
    140154}
  • trunk/src/VBox/Main/cbinding/cbinding.h

    r16497 r16684  
    5656VBOXXPCOMC_DECL(int) VBoxUtf8ToUtf16(const char *pszString, PRUnichar **ppwszString);
    5757
     58/* Getting and Setting the Enviornment Variables */
     59VBOXXPCOMC_DECL(const char*) VBoxGetEnv(const char *pszVar);
     60VBOXXPCOMC_DECL(int) VBoxSetEnv(const char *pszVar, const char *pszValue);
     61
    5862#ifdef __cplusplus
    5963}
  • trunk/src/VBox/Main/cbinding/makefile.tstLinuxC

    r16550 r16684  
    3232
    3333.PHONY: all
    34 all: tstLinuxC run
     34all: tstLinuxC
    3535
    3636.PHONY: clean
    3737clean:
    38         rm -f tstLinuxC.o tstLinuxC run
     38        rm -f tstLinuxC.o tstLinuxC
    3939
    4040tstLinuxC: tstLinuxC.o
     
    4343tstLinuxC.o: tstLinuxC.c
    4444        $(CC) $(CFLAGS) -DRT_OS_LINUX -DMOZ_UNICODE $(INCS_XPCOM) -o $@ -c $<
    45 
    46 run:
    47         echo "env VBOX_XPCOM_HOME=$(PATH_BIN) ./tstLinuxC" > $@
    48         chmod a+x $@
  • trunk/src/VBox/Main/cbinding/tstLinuxC.c

    r16548 r16684  
    306306    PRUnichar *homefolderUtf16  = NULL;
    307307    nsresult rc;     /* Result code of various function (method) calls. */
     308    FILE *fpsetenv;
     309
     310    if ((fpsetenv = fopen("/opt/VirtualBox/VBoxXPCOMC.so", "r")) != NULL) {
     311        VBoxSetEnv("VBOX_APP_HOME","/opt/VirtualBox/");
     312        fclose (fpsetenv);
     313    }
     314    if ((fpsetenv = fopen("/usr/lib/virtualbox/VBoxXPCOMC.so", "r")) != NULL) {
     315        VBoxSetEnv("VBOX_APP_HOME","/usr/lib/virtualbox/");
     316        fclose (fpsetenv);
     317    }
    308318
    309319    printf("Starting Main\n");
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette