Patch level : 10.0
Files correlati : ba0.exe Ricompilazione Demo : [ ] Commento : Corretta gestione eseguibili personalizzati in custom git-svn-id: svn://10.65.10.50/trunk@20425 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
28bc6659d7
commit
c3bb05f007
@ -6,11 +6,12 @@
|
|||||||
#include <recarray.h>
|
#include <recarray.h>
|
||||||
#include <user.h>
|
#include <user.h>
|
||||||
|
|
||||||
|
// Il programma attuale NON e' ne' ba0 ne ba1 e si usa il menu in stile Outlook?
|
||||||
static bool is_outlook_menu_chain()
|
static bool is_outlook_menu_chain()
|
||||||
{
|
{
|
||||||
const TFilename n = __argv[0];
|
const TFilename n = __argv[0];
|
||||||
const TString& app = n.name_only();
|
const TString& app = n.name_only();
|
||||||
if (app.match("*ba[0,1]*", true))
|
if (app.match("ba[0,1]", true) != 0)
|
||||||
return false;
|
return false;
|
||||||
return ini_get_int(CONFIG_GUI, "Colors", "TreeView") == 3;
|
return ini_get_int(CONFIG_GUI, "Colors", "TreeView") == 3;
|
||||||
}
|
}
|
||||||
@ -31,48 +32,50 @@ long TExternal_app::run(
|
|||||||
TFilename path(_path);
|
TFilename path(_path);
|
||||||
|
|
||||||
TFilename comm_name(_path);
|
TFilename comm_name(_path);
|
||||||
int p = comm_name.find(" -"); //c'e' un - nella stringa?
|
|
||||||
if (p > 0) //se c'e' tronca il nome allo spazio
|
|
||||||
comm_name.cut(p);
|
|
||||||
p = comm_name.find(" /"); //c'e' un / nella stringa?
|
|
||||||
if (p > 0) //se c'e' tronca il nome allo spazio
|
|
||||||
comm_name.cut(p);
|
|
||||||
|
|
||||||
|
//se c'e' - o / tronca il nome allo spazio precedente
|
||||||
|
const int pm = comm_name.find(" -"); //c'e' un - nella stringa?
|
||||||
|
const int ps = comm_name.find(" /"); //c'e' un / nella stringa?
|
||||||
|
int params = -1;
|
||||||
|
if (pm > 0 && (pm < ps || ps <= 0))
|
||||||
|
params = pm; else
|
||||||
|
if (ps > 0)
|
||||||
|
params = ps;
|
||||||
|
if (params > 0)
|
||||||
|
comm_name.cut(params);
|
||||||
if (*comm_name.ext() == '\0') //se non c'e' estensione ci mette .exe (sono programmi)
|
if (*comm_name.ext() == '\0') //se non c'e' estensione ci mette .exe (sono programmi)
|
||||||
comm_name.ext("exe");
|
comm_name.ext("exe");
|
||||||
|
|
||||||
const bool found = comm_name.custom_path(); //cerca il file in custom o in locale
|
const bool found = comm_name.custom_path(); //cerca il file in custom o in locale
|
||||||
|
|
||||||
TString name(comm_name.name());
|
|
||||||
if (utente == 1) // utente puo' essere 0 = No, 1 = Si, 3 = Forzatura
|
if (utente == 1) // utente puo' essere 0 = No, 1 = Si, 3 = Forzatura
|
||||||
{
|
{
|
||||||
|
const TString& name = comm_name.name_only();
|
||||||
bool our_app = name.len() > 2;
|
bool our_app = name.len() > 2;
|
||||||
if (our_app && atoi(name) < 70)
|
if (our_app && atoi(name) < 70)
|
||||||
{
|
{
|
||||||
our_app = isalpha(name[0]) && isalpha(name[1]) && isdigit(name[2]);
|
our_app = isalpha(name[0]) && isalpha(name[1]) && isdigit(name[2]);
|
||||||
}
|
}
|
||||||
if (!our_app)
|
if (!our_app) // Non e' un programma di campo per cui ...
|
||||||
utente = false;
|
utente = 0; // ... non aggiungo il codice utente al comando
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found && p > 0)
|
if (found)
|
||||||
{
|
{
|
||||||
path = comm_name;
|
path = comm_name;
|
||||||
path << _path.mid(p);
|
if (params > 0)
|
||||||
|
path << _path.mid(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (utente)
|
if (utente)
|
||||||
path << " /u" << user();
|
path << " /u" << user();
|
||||||
|
|
||||||
// save cwd
|
// save cwd
|
||||||
DIRECTORY oldir;
|
DIRECTORY oldir; xvt_fsys_get_dir(&oldir);
|
||||||
xvt_fsys_get_dir(&oldir);
|
|
||||||
|
|
||||||
if (!utente) // cambio directory se eseguo un programma estero
|
if (!utente && found) // cambio directory se eseguo un programma estero
|
||||||
{
|
{
|
||||||
TFilename dir(comm_name.path());
|
TFilename dir(path.path());
|
||||||
dir.lower();
|
if (dir.full())
|
||||||
if (dir.full() && dir.find("custom") < 0)
|
|
||||||
{
|
{
|
||||||
DIRECTORY d;
|
DIRECTORY d;
|
||||||
if (xvt_fsys_convert_str_to_dir(dir, &d))
|
if (xvt_fsys_convert_str_to_dir(dir, &d))
|
||||||
@ -83,7 +86,7 @@ long TExternal_app::run(
|
|||||||
TString256 old_title; // Vecchio titolo della finestra principale
|
TString256 old_title; // Vecchio titolo della finestra principale
|
||||||
bool close_all = false; // Chiudi tutti i file in caso di manutenzione
|
bool close_all = false; // Chiudi tutti i file in caso di manutenzione
|
||||||
|
|
||||||
if (!async)
|
if (!async && utente)
|
||||||
{
|
{
|
||||||
close_all = _path.starts_with("ba1 -0") && prefix_valid();
|
close_all = _path.starts_with("ba1 -0") && prefix_valid();
|
||||||
if (close_all) //se lancia la gestione archivi forza la chiusura dei files e pure dei tracciati!
|
if (close_all) //se lancia la gestione archivi forza la chiusura dei files e pure dei tracciati!
|
||||||
@ -95,7 +98,7 @@ long TExternal_app::run(
|
|||||||
dongle().logout();
|
dongle().logout();
|
||||||
|
|
||||||
// Programma normale (non menu) che chiama "collega"
|
// Programma normale (non menu) che chiama "collega"
|
||||||
if (utente && iconize && is_outlook_menu_chain())
|
if (iconize && is_outlook_menu_chain())
|
||||||
{
|
{
|
||||||
xvt_vobj_get_title(TASK_WIN, old_title.get_buffer(), old_title.size());
|
xvt_vobj_get_title(TASK_WIN, old_title.get_buffer(), old_title.size());
|
||||||
xvt_vobj_set_title(TASK_WIN, __MAGIC_CAPTION__);
|
xvt_vobj_set_title(TASK_WIN, __MAGIC_CAPTION__);
|
||||||
@ -120,7 +123,7 @@ long TExternal_app::run(
|
|||||||
// non ci saranno piu' posti liberi nell'HL_server: il programma comunque non
|
// non ci saranno piu' posti liberi nell'HL_server: il programma comunque non
|
||||||
// puo' interrompersi a meta'; ecco perche il valore di ritorno di HL_LOGIN viene
|
// puo' interrompersi a meta'; ecco perche il valore di ritorno di HL_LOGIN viene
|
||||||
// ignorato.
|
// ignorato.
|
||||||
if (!async)
|
if (!async && utente)
|
||||||
{
|
{
|
||||||
if (dongle().local())
|
if (dongle().local())
|
||||||
dongle().login();
|
dongle().login();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user