diff options
author | Michael Stahl <mstahl@redhat.com> | 2014-06-02 01:18:46 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-06-09 17:05:54 +0200 |
commit | 9a8c82c66eca101c87d01627522cb5f691d4ad74 (patch) | |
tree | 4f3ef4a5719efee40abc20b373385716ba00140b | |
parent | f517362fb6df839e9d1f828b286e1709cbbbe235 (diff) |
gbuild, gengal: Win32 make command line limit strikes again ...
... so add a response file parameter --filename.
Change-Id: Idc71de7508b571b0e0608a65b92cd45e6800f7c3
-rw-r--r-- | solenv/gbuild/Gallery.mk | 4 | ||||
-rw-r--r-- | svx/source/gengal/gengal.cxx | 67 |
2 files changed, 70 insertions, 1 deletions
diff --git a/solenv/gbuild/Gallery.mk b/solenv/gbuild/Gallery.mk index 82c5e787145a..2ce708d8bdb3 100644 --- a/solenv/gbuild/Gallery.mk +++ b/solenv/gbuild/Gallery.mk @@ -31,6 +31,7 @@ define gb_Gallery__command $(call gb_Output_announce,$(2),$(true),GAL,1) $(call gb_Helper_abbreviate_dirs,\ rm -f $(call gb_Gallery_get_workdir,$(2))/* && \ + RESPONSEFILE=$(call var2file,$(shell $(call gb_MKTEMP)),100,$(GALLERY_FILES)) && \ $(call gb_Helper_print_on_error,\ $(if $(filter-out MACOSX WNT,$(OS_FOR_BUILD)),$(if $(ENABLE_HEADLESS),, \ SAL_USE_VCLPLUGIN=svp \ @@ -41,9 +42,10 @@ $(call gb_Helper_abbreviate_dirs,\ --destdir $(GALLERY_BASEDIR) \ --name "$(GALLERY_NAME)" \ --path $(call gb_Gallery_get_workdir,$(2)) \ - $(GALLERY_FILES),\ + --filenames $(call gb_Helper_make_url,$$RESPONSEFILE),\ $@.log \ ) && \ + rm $$RESPONSEFILE && \ touch $@ \ ) endef diff --git a/svx/source/gengal/gengal.cxx b/svx/source/gengal/gengal.cxx index 547fb4f969be..ca045cfd9de0 100644 --- a/svx/source/gengal/gengal.cxx +++ b/svx/source/gengal/gengal.cxx @@ -208,6 +208,71 @@ void GalApp::Init() } } +std::vector<OUString> ReadResponseFile_Impl(OUString const& rInput) +{ + osl::File file(rInput); + osl::FileBase::RC rc = file.open(osl_File_OpenFlag_Read); + OString const uInput(rtl::OUStringToOString(rInput, RTL_TEXTENCODING_UTF8)); + if (osl::FileBase::E_None != rc) + { + fprintf(stderr, "error while opening response file: %s (%d)\n", + uInput.getStr(), rc); + exit(1); + } + + std::vector<OUString> ret; + OUStringBuffer b; + char buf[1<<16]; + while (true) + { + sal_uInt64 size(0); + rc = file.read(buf, sizeof(buf), size); + if (osl::FileBase::E_None != rc) + { + fprintf(stderr, "error while reading response file: %s (%d)\n", + uInput.getStr(), rc); + exit(1); + } + if (!size) + break; + for (sal_uInt64 i = 0; i < size; ++i) + { + if (static_cast<unsigned char>(buf[i]) >= 128) + { + fprintf(stderr, "non-ASCII character in response file: %s\n", + uInput.getStr()); + exit(1); + } + switch (buf[i]) + { + case ' ' : + case '\t': + case '\r': + case '\n': + if (!b.isEmpty()) + ret.push_back(b.makeStringAndClear()); + break; + default: + b.append(buf[i]); + break; + } + } + } + if (!b.isEmpty()) + ret.push_back(b.makeStringAndClear()); + return ret; +} + +void +ReadResponseFile(std::vector<INetURLObject> & rFiles, OUString const& rInput) +{ + std::vector<OUString> files(ReadResponseFile_Impl(rInput)); + for (size_t i = 0; i < files.size(); ++i) + { + rFiles.push_back(Smartify(files[i])); + } +} + int GalApp::Main() { OUString aPath, aDestDir; @@ -239,6 +304,8 @@ int GalApp::Main() else if ( aParam == "--number-from" ) fprintf ( stderr, "--number-from is deprecated, themes now " "have filenames based on their names\n" ); + else if ( aParam == "--filenames" ) + ReadResponseFile(aFiles, GetCommandLineParam(++i)); else aFiles.push_back( Smartify( aParam ) ); } |