int getHomeDir (const char *pszProgDir, String &homeDir) { #ifndef ANDROID if (pszProgDir == NULL) { return -1; } // Compute the Home Directory // Assume that the executable is in <home>\\bin (or <home/bin>) char szHomeDir[PATH_MAX]; strcpy (szHomeDir, pszProgDir); // Strip off last directory level in path char *pszTemp = strrchr (szHomeDir, getPathSepChar()); if (pszTemp == NULL) { checkAndLogMsg ("main", Logger::L_SevereError, "executable not installed in expected directory structure - could not parse directory " "<%s> to compute the config file directory\n", pszProgDir); #if defined (WIN32) printf ("\n\n"); system ("pause"); #endif return -2; } *pszTemp = '\0'; homeDir = szHomeDir; #endif return 0; }
//For every ECLWatchVisible dropzones, read: dropZoneName, directory, and, if available, computer. //For every Servers/Server in ECLWatchVisible dropzones, read: directory, // server name, and hostname(or IP). Create dropzone("@name", "@directory", "@computer", // "@netAddress", "@linux", "@sourceNode") tree into pSoftware. void CFileSpraySoapBindingEx::appendDropZones(double clientVersion, IConstEnvironment* env, const char* dfuwuidSourcePartIP, IPropertyTree* softwareTree) { Owned<IConstDropZoneInfoIterator> dropZoneItr = env->getDropZoneIterator(); ForEach(*dropZoneItr) { IConstDropZoneInfo& dropZoneInfo = dropZoneItr->query(); if (!dropZoneInfo.isECLWatchVisible()) //This code is used by ECLWatch. So, skip the DZs not for ECLWatch. continue; SCMStringBuffer dropZoneName, directory, computerName; dropZoneInfo.getName(dropZoneName); dropZoneInfo.getDirectory(directory); if (!dropZoneName.length() || !directory.length()) continue; bool isLinux = getPathSepChar(directory.str()) == '/' ? true : false; Owned<IConstDropZoneServerInfoIterator> dropZoneServerItr = dropZoneInfo.getServers(); ForEach(*dropZoneServerItr) { IConstDropZoneServerInfo& dropZoneServer = dropZoneServerItr->query(); StringBuffer name, server, networkAddress; dropZoneServer.getName(name); dropZoneServer.getServer(server); if (name.isEmpty() || server.isEmpty()) continue; IPropertyTree* dropZone = softwareTree->addPropTree("DropZone", createPTree()); dropZone->setProp("@name", dropZoneName.str()); dropZone->setProp("@computer", name.str()); dropZone->setProp("@directory", directory.str()); if (isLinux) dropZone->setProp("@linux", "true"); IpAddress ipAddr; ipAddr.ipset(server.str()); ipAddr.getIpText(networkAddress); if (!ipAddr.isNull()) { dropZone->addProp("@netAddress", networkAddress); if (!isEmptyString(dfuwuidSourcePartIP)) { IpAddress ip(dfuwuidSourcePartIP); if (ip.ipequals(ipAddr)) dropZone->addProp("@sourceNode", "1"); } } } } }
String getfilename (const String &path) { String parentDir, fileName; split (path, parentDir, fileName, getPathSepChar()); return fileName; }
String getparentdir (const String &path) { String parentDir, fileName; split (path, parentDir, fileName, getPathSepChar()); return parentDir; }