Update temporal
Change-Id: I541455a5a5096792165a8653470ba1aa2b0b3bc8
This commit is contained in:
parent
3ea10f6fd9
commit
7edd068716
1 changed files with 14 additions and 6 deletions
|
@ -54,6 +54,8 @@
|
|||
#include <bitmaps.hlst>
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <unicode/unistr.h>
|
||||
|
||||
constexpr OUString TM_SETTING_MANAGER = u"TemplateManager"_ustr;
|
||||
constexpr OUString TM_SETTING_LASTFOLDER = u"LastFolder"_ustr;
|
||||
|
@ -1037,15 +1039,18 @@ void SfxTemplateManagerDlg::OnTemplateImportCategory(std::u16string_view sCatego
|
|||
/* Based on OnTemplateImportCategory */
|
||||
void SfxTemplateManagerDlg::OnTemplateImportGmxCategory(std::u16string_view sCategory)
|
||||
{
|
||||
// Convertir std::u16string_view a std::u16string
|
||||
std::u16string sCategoryStr(sCategory);
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
|
||||
std::string categoryUTF8 = convert.to_bytes(sCategoryStr);
|
||||
std::cout << "La categoría es:" << categoryUTF8 <<std::endl;
|
||||
|
||||
// Convertir std::u16string a UnicodeString (ICU)
|
||||
icu::UnicodeString unicodeString(reinterpret_cast<const UChar*>(sCategoryStr.data()), sCategoryStr.size());
|
||||
// Convertir std::u16string_view a std::u16string
|
||||
std::string category;
|
||||
unicodeString.toUTF8String(category);
|
||||
std::cout << "La categoría es:" << category <<std::endl;
|
||||
// Ruta del repositorio git y la carpeta de destino
|
||||
const std::string repoUrl = "https://repos.libreoffice.gob.mx/templates/" + categoryUTF8;
|
||||
const std::string repoUrl = "https://repos.libreoffice.gob.mx/templates/" + category;
|
||||
//const std::string tempDir = "/tmp/temporal-office-templates";
|
||||
fs::path tempDir = fs::temp_directory_path() / "temporal-gmx-templates" / categoryUTF8;
|
||||
fs::path tempDir = fs::temp_directory_path() / "temporal-gmx-templates" / category;
|
||||
|
||||
// Verificar si el directorio temporal existe
|
||||
if (!fs::exists(tempDir))
|
||||
|
@ -1054,6 +1059,9 @@ void SfxTemplateManagerDlg::OnTemplateImportGmxCategory(std::u16string_view sCat
|
|||
}
|
||||
// Ejecutar el comando git clone
|
||||
std::string command = "wget -r -np -nH --cut-dirs=2 -P " + tempDir.string() + " " + repoUrl;
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
std::string command = "curl -o " + tempDir.string() + " " + repoUrl;
|
||||
#endif
|
||||
std::cout <<"El comando: " << command << std::endl;
|
||||
int result = std::system(command.c_str());
|
||||
if (result != 0)
|
||||
|
|
Loading…
Reference in a new issue