File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
src/GitLab.VisualStudio/Services Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -114,9 +114,9 @@ private void SaveUserToLocal(User user)
114114 System . IO . File . WriteAllText ( _path , Newtonsoft . Json . JsonConvert . SerializeObject ( user ) ) ;
115115 user . PrivateToken = pt ;
116116 }
117- catch ( Exception )
117+ catch ( Exception )
118118 {
119-
119+
120120 }
121121 }
122122
@@ -144,11 +144,13 @@ private User LoadUser()
144144 try
145145 {
146146 var _path = System . IO . Path . Combine ( Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) , $ "{ new Uri ( Host ) . Host } .gitlab4vs") ;
147- if ( System . IO . File . Exists ( _path ) )
147+ if ( ! System . IO . File . Exists ( _path ) )
148148 {
149- _user = Newtonsoft . Json . JsonConvert . DeserializeObject < User > ( System . IO . File . ReadAllText ( _path ) ) ;
150- _user . PrivateToken = GetToken ( _user . Host ) ;
149+ _path = System . IO . Path . Combine ( Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) , $ "{ new Uri ( Strings . DefaultHost ) . Host } .gitlab4vs") ;
151150 }
151+
152+ _user = Newtonsoft . Json . JsonConvert . DeserializeObject < User > ( System . IO . File . ReadAllText ( _path ) ) ;
153+ _user . PrivateToken = GetToken ( _user . Host ) ;
152154 }
153155 catch ( Exception ex )
154156 {
@@ -222,11 +224,11 @@ public bool HaveHost(string host)
222224 }
223225 result = HostVersionInfo . ContainsKey ( host ) ;
224226
225- if ( ! result && Uri . TryCreate ( host , UriKind . Absolute , out Uri uri ) )
227+ if ( ! result && Uri . TryCreate ( host , UriKind . Absolute , out Uri uri ) )
226228 {
227229 result = HostVersionInfo . ContainsKey ( uri . Host ) ;
228230 }
229-
231+
230232 return result ;
231233 }
232234
You can’t perform that action at this time.
0 commit comments