Include extra files in build/deployment - qt

I want to include an entire folder in the build/deployment of my Qt project.
I have this in my .pro file:
html_folder.source = html
html_folder.target = .
DEPLOYMENTFOLDERS = html_folder
...
defineTest(addHTML) {
for(deploymentfolder, DEPLOYMENTFOLDERS) {
item = item$${deploymentfolder}
itemsources = $${item}.files
$$itemsources = $$eval($${deploymentfolder}.source)
itempath = $${item}.path
$$itempath= $$eval($${deploymentfolder}.target)
export($$itemsources)
export($$itempath)
DEPLOYMENT += $$item
}
export (DEPLOYMENT)
}
addHTML()
That used to work with Qt 4.x, maybe even 5.x, but now I'm trying to port my project to 5.7 and it's not working, as in, it's not copying my folder to the build/deployment folder.
What changed caused this to stop working? How can I make it work again?

Related

Qt Installer Framework Change Installation path and add subfolder

How to change the installer path and add subfolder using qt installer framework.
Default output:
C:\Program Files (x86)\Subfolder
I want to path to example output.
Example output:
D:\Subfolder
C:\Desktop\Subfolder
C:\Documents\Subfolder
I know this is old but maybe is usefull for someone.
I changed a Qt Installer Framework example called dynamicpage (look in QtIfw examples dir), where the target directory is selected from a custom widget called targetwidgetui. To avoid the user write directly in the line edit I added in my file config/controllerscript.qs this code:
Controller.prototype.TargetDirectoryPageCallback = function()
{
currentPage.TargetDirectoryLineEdit.enabled = false;
}
I also added #ApplicationsDir#/MyAppFolder in config.xml so this is the default install path.
When the user change the destination folder I take the path and append "/MyAppFolder". To do this I changed a function in the dynamicpage example, in file installscript.qs. This is how my function look like now:
Component.prototype.chooseTarget = function () {
var widget = gui.pageWidgetByObjectName("DynamicTargetWidget");
if (widget != null) {
var newTarget = QFileDialog.getExistingDirectory("Choose your target directory.", widget
.targetDirectory.text);
if (newTarget != "")
{
newTarget += "/MyAppFolder"; // The same subfolder of TargetDir in config.xml
widget.targetDirectory.text = Dir.toNativeSparator(newTarget);
}
}
}
Using this you will append always your folder to the installation path.
In your config.xml file you can add
<TargetDir>*YOUR_PATH*/subfolder</TargetDir>
To install to a custom directory.
From Qt Installer Framework documentation:
TargetDir
Default target directory for installation. On Linux, this is usually the user's home directory.
Note that you can use predefined variables like #ApplicationsDir# or #DesktopDir# as stated here.

Put property file into a jar file using ProcessBuilder

I need to put a property file named "customer.properties" into the "distribution.jar". Fle paths for above files are;
modules\distribution.jar
modules\distributionaManager\customer.properties
My requirement is to have "modules\distribution.ja\distributionaManager\customer.properties"
ProcessBuilder pb = new ProcessBuilder("jar", "uf", "distribution.jar", "distributionaManager\\customer.properties");
pb.directory(jarFile.getParentFile());
try
{
Process process = pb.start();
process.waitFor();
process.destroy();
}
jarFile.getParentFile() - "modules directory"
But this code creates no property file inside the jar. Any suggestions?
Thanks

Copy file from one folder to another folder

I am working on website in which i want to copy the file from my application folder to other folder on same server (But this folder is out of my application folder i.e. my application on C driver and the destination folder is on D drive).Is this possible using any functionality of Asp.Net?
Thanks in advance.
YES it's possible, the only concern that you have to watch for is that the CopyTo path should be the full path, not the relative one (ex: c:\websites\myOtherFolder).
this way, you can successfully copy/move the file from your ASP.NET code.
below is a pseudo code to show you how to get it done (assuming that the file has been placed on the root folder of your ASP.NET Application).
using System.IO;
..
..
..
// Get the current app path:
var currentApplicationPath = HttpContext.Current.Request.PhysicalApplicationPath;
//Get the full path of the file
var fullFilePath = currentApplicationPath + fileNameWithExtension;
// Get the destination path
var copyToPath = "This has to be the full path to your destination directory.
Example d:\myfolder";
// Copy the file
File.Copy(fullFilePath , copyToPath );
use this function:
System.IO.File.Copy(FileToCopy, NewCopy)
It's very easy to move file from one folder to other folder. you can change the file name while moving...
string Tranfiles, ProcessedFiles;
//Tranfiles = Server.MapPath(#"~\godurian\sth100\transfiles\" + Filename);
Tranfiles = Server.MapPath(#"~\transfiles\" + Filename);
if (File.Exists(Server.MapPath(#"~\transfiles\" + Filename)))
{
File.Delete(Server.MapPath(#"~\transfiles\" + Filename));
}
//ProcessedFiles = Server.MapPath(#"~\godurian\sth100\ProcessedFiles");
ProcessedFiles = Server.MapPath(#"~\ProcessedFiles");
File.Move(Tranfiles, ProcessedFiles);
That's it now you can check your application folder to confirm the move process status

Channel.Security.Error...Error #2048

I recently upgraded to Flash Builder 4.5 for PHP and am trying to upload a release build to my remoteserver. When I try to make a php call from the app, I get the error:
Send failednChannel.Security.Error error Error #2048 url: 'http://localhost/my_php/public/gateway.php'
The release build works fine on my localhost machine. All of my php service calls are on my remote host. Here's the structure of my remote host:
/my_directory/html (this is the root directory)
/my_directory/html/my_php/public/release (this is where my .html wrapper and .swf files sit)
/my_directory/html/my_php/public (this is where my gateway.php and amf_config.ini files sit)
The error specifically references 'localhost', but I can't find where that gets set. When I google error #2048, the solutions point to a badly configured crossdomain file...all my services are on remotehost (where the app is hosted) so I don't think that could be the issue.
Here is my amf_config.ini file:
[zend]
webroot = "/my_directory/html"
zend_path ="/my_directory/html/ZendFramework/library"
library ="/my_directory/html/my_php/library"
services ="/my_directory/html/my_php/services"
[zendamf]
amf.production = false
amf.directories[]=/my_directory/html/my_php/services
Here is my gateway.php file:
<?php
ini_set("display_errors", 1);
$dir = dirname(__FILE__);
$webroot = $_SERVER['DOCUMENT_ROOT'];
$configfile = "$dir/amf_config.ini";
$servicesdir = $dir.'/../services';
$librarydir = $dir.'/../library';
//default zend install directory
$zenddir = $webroot.'/ZendFramework/library';
//Load ini file and locate zend directory
if (file_exists($configfile)) {
$arr = parse_ini_file($configfile, true);
if (isset($arr['zend']['webroot'])) {
$webroot = $arr['zend']['webroot'];
$zenddir = $webroot.'/ZendFramework/library';
}
if (isset($arr['zend']['zend_path'])) {
$zenddir = $arr['zend']['zend_path'];
}
if (isset($arr['zend']['library'])) {
$librarydir = $arr['zend']['library'];
}
if (isset($arr['zend']['services'])) {
$servicesdir = $arr['zend']['services'];
}
}
// Setup include path
// add zend directory, library and services to include path
set_include_path(get_include_path()
.PATH_SEPARATOR.$zenddir
.PATH_SEPARATOR.$librarydir
.PATH_SEPARATOR.$servicesdir);
// Initialize Zend Framework loader
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true)->suppressNotFoundWarnings(true);
// Load configuration
$default_config = new Zend_Config(array("production" => false), true);
$default_config->merge(new Zend_Config_Ini($configfile, 'zendamf'));
$default_config->setReadOnly();
$amf = $default_config->amf;
// Store configuration in the registry
Zend_Registry::set("amf-config", $amf);
// Initialize AMF Server
$server = new Zend_Amf_Server();
$server->setProduction($amf->production);
if (isset($amf->directories)) {
$dirs = $amf->directories->toArray();
foreach ($dirs as $dir) {
if ($dir == "./") {
$server->addDirectory($webroot);
} else
if (realpath("{$webroot}/{$dir}")) {
$server->addDirectory("{$webroot}/{$dir}");
} else
if (realpath($dir)) {
$server->addDirectory(realpath($dir));
}
}
}
// Initialize introspector for non-production
if (! $amf->production) {
$server->setClass('Zend_Amf_Adobe_Introspector', '',
array("config" => $default_config, "server" => $server));
$server->setClass('Zend_Amf_Adobe_DbInspector', '',
array("config" => $default_config, "server" => $server));
}
// Handle request
echo $server->handle();
i had the same problem in a flex - blaze - environment. The real Problem was the context-root in the project properties.
because you used flex 4.5, there is no input field for this setting. in flex builder 3, there was a setting in the project properties -> flex server -> context root.
i gone crazy and found after hours an article on adobes bugs-site [FB-22939].
That solve my problem. I have no idea, wich project settings you are using, try to search a string named {context.root} in your project or post a liite bit more about your project settings. i know blaze is different from php, but maybe it is a tip bringing you back on track.
Unfortunately I'm not able to reproduce my thread and setting up an php environment with more knowledge about your setup. (Server-Technology, and so one)
edit:
additional Info:
I've found a list of all compiler arguments. Try it with this argument:
-context-root <context-path>
full name -compiler.context-root
path to replace {context.root} tokens for service channel endpoints
br
Frank

openWithDefaultApplication fails on files in application folder

I'll ONLY recieve an "Error #3000: Illegal path name" if I try to open a file which is placed inside the app-folder of the air. If the file is somewhere else outside of the app-folder it works.
private var file:File = File.documentsDirectory;
public function download():void{
var pdfFilter:FileFilter = new FileFilter("PDF Files", "*.pdf");
file.browseForOpen("Open", [pdfFilter]);
file.addEventListener(Event.SELECT, fileSelected);
}
private function fileSelected(e:Event):void
{
var destination:File = File.applicationDirectory
destination = destination.resolvePath("test.pdf");
/*
//This works, also if the file to copy is placed inside the appfolder
file.copyTo(destination, true);
*/
/*This Throws me an Error #3000, but ONLY if the file is located in
the App folder*/
file.openWithDefaultApplication();
}
When i try to get the same file and copy it to another place it's doing fine.
Why that? Something special to do if i wanna open files which are inside the appfolder?
It also don't work in debug mode - bin-debug.
Regards, Temo
After reading the document a few times i saw that this is not possible (it's not a bug, it's a feature!?!)
Opening files with the default system application
You cannot use the openWithDefaultApplication() method with files located in the application directory.
So I do this instead:
file.copyTo(tempFile);
tempFile.openWithDefaultApplication();
Not so nice, but it works.

Resources