Altro test x riconoscere path locale...

This commit is contained in:
Samuele E. Locatelli
2019-11-30 10:42:27 +01:00
parent 77ce071aee
commit ea843419ab
2 changed files with 43 additions and 5 deletions
Vendored
+1 -1
View File
@@ -11,7 +11,7 @@ pipeline {
steps {
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
script {
withEnv(['NEXT_BUILD_NUMBER=703']) {
withEnv(['NEXT_BUILD_NUMBER=705']) {
// env.versionNumber = VersionNumber(versionNumberString : '3.5.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
env.versionNumber = VersionNumber(versionNumberString : '3.5.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
env.versionNumberBeta = VersionNumber(versionNumberString : '3.5.${BUILD_DATE_FORMATTED, "yyMM"}-beta.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
+42 -4
View File
@@ -94,6 +94,21 @@ namespace SteamWare
#endregion
/// <summary>
/// Recupera path correttamente (se fisico o virtuale
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
protected string GetPath(string path)
{
if (Path.IsPathRooted(path))
{
return path;
}
// altrimenti MapPath!
return System.Web.HttpContext.Current.Server.MapPath(path);
}
/// <summary>
/// cerca di caricare il fileinfo o da httpcontext-application re-position o direttamente come workpath + nomefile
/// </summary>
@@ -102,6 +117,16 @@ namespace SteamWare
private FileInfo getFileInfoByName(string _nomeFile)
{
FileInfo _fi;
try
{
_fi = new FileInfo(GetPath(_workPath + "\\" + _nomeFile));
}
catch (Exception exc)
{
logger.lg.scriviLog($"Errore in recupero info file: {_nomeFile}{Environment.NewLine}{exc}", tipoLog.EXCEPTION);
_fi = new FileInfo(_workPath + "\\" + _nomeFile);
}
#if false
// se nomefile contiene "/" --> faccio mappath altrimenti è percorso fisico...
if (_nomeFile.IndexOf("/") < 0)
{
@@ -111,7 +136,7 @@ namespace SteamWare
}
catch (Exception exc)
{
logger.lg.scriviLog(string.Format("Errore in recupero info file:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
logger.lg.scriviLog($"Errore in recupero info file{_nomeFile}:{Environment.NewLine}{exc}", tipoLog.EXCEPTION);
_fi = new FileInfo(_workPath + "\\" + _nomeFile);
}
}
@@ -123,10 +148,11 @@ namespace SteamWare
}
catch (Exception exc)
{
logger.lg.scriviLog(string.Format("Errore in recupero info file:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
logger.lg.scriviLog($"Errore in recupero info file{_nomeFile}:{Environment.NewLine}{exc}", tipoLog.EXCEPTION);
_fi = new FileInfo(_workPath + "\\" + _nomeFile);
}
}
}
#endif
return _fi;
}
/// <summary>
@@ -138,6 +164,17 @@ namespace SteamWare
private FileInfo getFileInfoByName(string _path, string _nomeFile)
{
FileInfo _fi;
try
{
_fi = new FileInfo(GetPath(_path + _nomeFile));
}
catch (Exception exc)
{
logger.lg.scriviLog($"Errore in recupero info path: {_path} | file: {_nomeFile}{Environment.NewLine}{exc}", tipoLog.EXCEPTION);
_fi = new FileInfo(_path + "\\" + _nomeFile);
}
#if false
try
{
_fi = new FileInfo(System.Web.HttpContext.Current.Server.MapPath(_path + _nomeFile));
@@ -146,7 +183,8 @@ namespace SteamWare
catch
{
_fi = new FileInfo(_path + "\\" + _nomeFile);
}
}
#endif
return _fi;
}
/// <summary>