diff --git a/Jenkinsfile b/Jenkinsfile index aa46319..7d790e7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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}') diff --git a/SteamWareLib/fileMover.cs b/SteamWareLib/fileMover.cs index 3f6575e..cf49a8a 100644 --- a/SteamWareLib/fileMover.cs +++ b/SteamWareLib/fileMover.cs @@ -94,6 +94,21 @@ namespace SteamWare #endregion + /// + /// Recupera path correttamente (se fisico o virtuale + /// + /// + /// + protected string GetPath(string path) + { + if (Path.IsPathRooted(path)) + { + return path; + } + // altrimenti MapPath! + return System.Web.HttpContext.Current.Server.MapPath(path); + } + /// /// cerca di caricare il fileinfo o da httpcontext-application re-position o direttamente come workpath + nomefile /// @@ -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; } /// @@ -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; } ///