//! initializes this resource void MeshResource::ResourceInit() { auto meshResourcePath = GetTemplatePath(); m_MeshPath = Utils::GetFilePathNoExt(meshResourcePath) + ".fbx"; if (!m_sMeshReload) m_SubMeshInfos.clear(); #ifndef SHOOT_EDITOR LoadFS(m_MeshPath.c_str()); #else auto binPath = Utils::GetBinPath(m_MeshPath); bool dirty = true; if (File::Exists(binPath.c_str())) dirty = Utils::IsFileMoreRecent(m_MeshPath, binPath) || Utils::IsFileMoreRecent(meshResourcePath, binPath); if (dirty) { Log.Print("Converting FBX '%s'\n", m_MeshPath.c_str()); auto binFile = Utils::CreateBinFile(binPath); FBXMeshLoader(this).Load(m_MeshPath.c_str(), binFile); binFile->Close(); sdelete(binFile); } else LoadFS(binPath.c_str()); #endif for (auto& submesh : m_SubMeshInfos) submesh.m_VertexBuffer->SetDynamic(m_bDynamic); }
void ChkFs(void) { struct sam_fs_status *fsarray = NULL; flock_t fsd_lock; char *fsdLockName = SAM_SAMFS_PATH"/"SAM_FSD; char *pkgchk = PKGCHK; int fd; int pid; int status; #ifdef sun if (system(pkgchk)) { exit(EXIT_FAILURE); } if ((fd = open(fsdLockName, O_RDWR)) < 0) { error(EXIT_FAILURE, errno, GetCustMsg(613), fsdLockName); } memset(&fsd_lock, 0, sizeof (flock_t)); fsd_lock.l_type = F_WRLCK; fsd_lock.l_whence = SEEK_SET; if (fcntl(fd, F_SETLKW, &fsd_lock) == -1) { close(fd); error(EXIT_FAILURE, errno, GetCustMsg(12020), program_name); } #endif /* sun */ LoadFS(NULL); if (GetFsStatus(&fsarray) > 0) { free(fsarray); close(fd); return; } /* * Filesystem is not configured. * Remove any SC config files and execute sam-fsd to configure. */ (void) system("/bin/rm -f " SAM_SC_DIR"/*"); /* "Configuring file system" */ printf("%s: %s\n", program_name, GetCustMsg(12021)); pid = fork(); if (pid == -1) { error(EXIT_FAILURE, errno, "Cannot fork"); } else if (pid == 0) { close(fd); execl(SAM_SAMFS_PATH"/"SAM_FSD, SAM_FSD, "-C", NULL); error(EXIT_FAILURE, errno, GetCustMsg(612), SAM_SAMFS_PATH"/"SAM_FSD); } else { waitpid(pid, &status, 0); close(fd); if (status != 0) { exit(EXIT_FAILURE); } } #ifdef sun /* * Enable sam-fsd */ printf("%s: Enabling the sam-fsd service.\n", program_name); pid = fork(); if (pid == -1) { error(EXIT_FAILURE, errno, "Cannot fork to enable sam-fsd"); } else if (pid == 0) { close(fd); execl("/usr/sbin/svcadm", "svcadm", "enable", "-t", SAM_FSD, NULL); error(EXIT_FAILURE, errno, "Cannot exec to enable sam-fsd"); } else { waitpid(pid, &status, 0); close(fd); } /* * Add appropriate service tags. */ printf("%s: Adding service tags.\n", program_name); pid = fork(); if (pid == -1) { /* Treat as nonfatal error */ printf("%s: Could not fork to add service tags.\n", program_name); } else if (pid == 0) { close(fd); execl(SAM_UTILITY_PATH"/"SAM_SERVICETAG, SAM_SERVICETAG, "add", NULL); printf("%s: Could not exec "SAM_SERVICETAG " to add service tags.\n", program_name); exit(0); } else { waitpid(pid, &status, 0); } close(fd); #endif /* sun */ }