void VJSRequireClass::_Initialize (const VJSParms_initialize &inParms, void *) { XBOX::VJSObject thisObject(inParms.GetObject()); XBOX::VJSArray arrayObject(inParms.GetContext()); XBOX::VFolder *folder = XBOX::VFolder::RetainSystemFolder(eFK_Executable, false); xbox_assert(folder != NULL); #if VERSIONMAC XBOX::VFolder *parentFolder = folder->RetainParentFolder(); XBOX::VFilePath path(parentFolder->GetPath(), "Modules/", FPS_POSIX); XBOX::ReleaseRefCountable<XBOX::VFolder>(&parentFolder); #else XBOX::VFilePath path(folder->GetPath(), "Modules/", FPS_POSIX); #endif XBOX::ReleaseRefCountable<XBOX::VFolder>(&folder); XBOX::VString defaultPath; path.GetPosixPath(defaultPath); thisObject.SetProperty("paths", arrayObject, JS4D::PropertyAttributeDontDelete); arrayObject.PushString(defaultPath); }
void VJSGlobalClass::Initialize( const VJSParms_initialize& inParms, VJSGlobalObject* inGlobalObject) { xbox_assert( inGlobalObject == NULL); // cause there's one and only one global class instance, created after the context // VJSGlobalClass::CreateGlobalClasses() is not called before by Wakanda Studio. // Add Buffer, SystemWorker, Folder, File, and TextStream object constructors. inParms.GetObject().SetProperty("Buffer", VJSBufferClass::MakeConstructor(inParms.GetContext()), JS4D::PropertyAttributeDontDelete | JS4D::PropertyAttributeReadOnly); inParms.GetObject().SetProperty("SystemWorker", VJSSystemWorkerClass::MakeConstructor(inParms.GetContext()), JS4D::PropertyAttributeDontDelete | JS4D::PropertyAttributeReadOnly); inParms.GetObject().SetProperty("Folder", VJSFolderIterator::MakeConstructor(inParms.GetContext()), JS4D::PropertyAttributeDontDelete | JS4D::PropertyAttributeReadOnly); inParms.GetObject().SetProperty("File", VJSFileIterator::MakeConstructor(inParms.GetContext()), JS4D::PropertyAttributeDontDelete | JS4D::PropertyAttributeReadOnly); inParms.GetObject().SetProperty("TextStream", VJSTextStream::MakeConstructor(inParms.GetContext()), JS4D::PropertyAttributeDontDelete | JS4D::PropertyAttributeReadOnly); inParms.GetObject().SetProperty("process", VJSProcess::CreateInstance( inParms.GetContext(), NULL), JS4D::PropertyAttributeDontDelete | JS4D::PropertyAttributeReadOnly); inParms.GetObject().SetProperty("os", VJSOS::CreateInstance( inParms.GetContext(), NULL), JS4D::PropertyAttributeDontDelete | JS4D::PropertyAttributeReadOnly); // Add LocalFileSystem and LocalFileSystemSync interfaces support. VJSLocalFileSystem::AddInterfacesSupport(inParms.GetContext()); }