< prev index next >

src/jdk.jpackage/linux/native/libapplauncher/LinuxPlatform.cpp

Print this page




  64 LinuxPlatform::~LinuxPlatform(void) {
  65 }
  66 
  67 TString LinuxPlatform::GetPackageAppDirectory() {
  68     return FilePath::IncludeTrailingSeparator(
  69             GetPackageRootDirectory()) + _T("app");
  70 }
  71 
  72 TString LinuxPlatform::GetAppName() {
  73     TString result = GetModuleFileName();
  74     result = FilePath::ExtractFileName(result);
  75     return result;
  76 }
  77 
  78 TString LinuxPlatform::GetPackageLauncherDirectory() {
  79     return FilePath::IncludeTrailingSeparator(
  80             GetPackageRootDirectory()) + _T("bin");
  81 }
  82 
  83 TString LinuxPlatform::GetPackageRuntimeBinDirectory() {
  84     return FilePath::IncludeTrailingSeparator(GetPackageRootDirectory()) + _T("runtime/bin");

  85 }
  86 
  87 void LinuxPlatform::ShowMessage(TString title, TString description) {
  88     printf("%s %s\n", PlatformString(title).toPlatformString(),
  89             PlatformString(description).toPlatformString());
  90     fflush(stdout);
  91 }
  92 
  93 void LinuxPlatform::ShowMessage(TString description) {
  94     TString appname = GetModuleFileName();
  95     appname = FilePath::ExtractFileName(appname);
  96     ShowMessage(PlatformString(appname).toPlatformString(),
  97             PlatformString(description).toPlatformString());
  98 }
  99 
 100 TCHAR* LinuxPlatform::ConvertStringToFileSystemString(TCHAR* Source,
 101         bool &release) {
 102     // Not Implemented.
 103     return NULL;
 104 }


1000 
1001 static void FreeXMLAttribute(XMLAttribute* attr) {
1002     if (attr == NULL) return;
1003     free(attr->_name);
1004     free(attr->_value);
1005     FreeXMLAttribute(attr->_next);
1006     free(attr);
1007 }
1008 
1009 /* Find element at current level with a given name */
1010 XMLNode* FindXMLChild(XMLNode* root, const TCHAR* name) {
1011     if (root == NULL) return NULL;
1012 
1013     if (root->_type == xmlTagType && JPACKAGE_STRCMP(root->_name, name) == 0) {
1014         return root;
1015     }
1016 
1017     return FindXMLChild(root->_next, name);
1018 }
1019 
1020 /* Search for an attribute with the given name and returns the contents. Returns NULL if
1021  * attribute is not found
1022  */
1023 TCHAR* FindXMLAttribute(XMLAttribute* attr, const TCHAR* name) {
1024     if (attr == NULL) return NULL;
1025     if (JPACKAGE_STRCMP(attr->_name, name) == 0) return attr->_value;
1026     return FindXMLAttribute(attr->_next, name);
1027 }
1028 
1029 void PrintXMLDocument(XMLNode* node, int indt) {
1030     if (node == NULL) return;
1031 
1032     if (node->_type == xmlTagType) {
1033         JPACKAGE_PRINTF(_T("\n"));
1034         indent(indt);
1035         JPACKAGE_PRINTF(_T("<%s"), node->_name);
1036         PrintXMLAttributes(node->_attributes);
1037         if (node->_sub == NULL) {
1038             JPACKAGE_PRINTF(_T("/>\n"));
1039         } else {
1040             JPACKAGE_PRINTF(_T(">"));
1041             PrintXMLDocument(node->_sub, indt + 1);




  64 LinuxPlatform::~LinuxPlatform(void) {
  65 }
  66 
  67 TString LinuxPlatform::GetPackageAppDirectory() {
  68     return FilePath::IncludeTrailingSeparator(
  69             GetPackageRootDirectory()) + _T("app");
  70 }
  71 
  72 TString LinuxPlatform::GetAppName() {
  73     TString result = GetModuleFileName();
  74     result = FilePath::ExtractFileName(result);
  75     return result;
  76 }
  77 
  78 TString LinuxPlatform::GetPackageLauncherDirectory() {
  79     return FilePath::IncludeTrailingSeparator(
  80             GetPackageRootDirectory()) + _T("bin");
  81 }
  82 
  83 TString LinuxPlatform::GetPackageRuntimeBinDirectory() {
  84     return FilePath::IncludeTrailingSeparator(GetPackageRootDirectory())
  85             + _T("runtime/bin");
  86 }
  87 
  88 void LinuxPlatform::ShowMessage(TString title, TString description) {
  89     printf("%s %s\n", PlatformString(title).toPlatformString(),
  90             PlatformString(description).toPlatformString());
  91     fflush(stdout);
  92 }
  93 
  94 void LinuxPlatform::ShowMessage(TString description) {
  95     TString appname = GetModuleFileName();
  96     appname = FilePath::ExtractFileName(appname);
  97     ShowMessage(PlatformString(appname).toPlatformString(),
  98             PlatformString(description).toPlatformString());
  99 }
 100 
 101 TCHAR* LinuxPlatform::ConvertStringToFileSystemString(TCHAR* Source,
 102         bool &release) {
 103     // Not Implemented.
 104     return NULL;
 105 }


1001 
1002 static void FreeXMLAttribute(XMLAttribute* attr) {
1003     if (attr == NULL) return;
1004     free(attr->_name);
1005     free(attr->_value);
1006     FreeXMLAttribute(attr->_next);
1007     free(attr);
1008 }
1009 
1010 /* Find element at current level with a given name */
1011 XMLNode* FindXMLChild(XMLNode* root, const TCHAR* name) {
1012     if (root == NULL) return NULL;
1013 
1014     if (root->_type == xmlTagType && JPACKAGE_STRCMP(root->_name, name) == 0) {
1015         return root;
1016     }
1017 
1018     return FindXMLChild(root->_next, name);
1019 }
1020 
1021 /* Search for an attribute with the given name and returns the contents.
1022  * Returns NULL if attribute is not found
1023  */
1024 TCHAR* FindXMLAttribute(XMLAttribute* attr, const TCHAR* name) {
1025     if (attr == NULL) return NULL;
1026     if (JPACKAGE_STRCMP(attr->_name, name) == 0) return attr->_value;
1027     return FindXMLAttribute(attr->_next, name);
1028 }
1029 
1030 void PrintXMLDocument(XMLNode* node, int indt) {
1031     if (node == NULL) return;
1032 
1033     if (node->_type == xmlTagType) {
1034         JPACKAGE_PRINTF(_T("\n"));
1035         indent(indt);
1036         JPACKAGE_PRINTF(_T("<%s"), node->_name);
1037         PrintXMLAttributes(node->_attributes);
1038         if (node->_sub == NULL) {
1039             JPACKAGE_PRINTF(_T("/>\n"));
1040         } else {
1041             JPACKAGE_PRINTF(_T(">"));
1042             PrintXMLDocument(node->_sub, indt + 1);


< prev index next >