Locally convex implies convex? There is a question about convex set.

Let $\Omega\subset\mathbb R^n$ be an open, connected set. If for any $x\in\overline{\Omega}$, there is a neighborhood $U_x$ such that $\Omega\cap U_x$ is convex, then $\Omega$ is convex.

Intuitively, if $\Omega$ is not convex, there must be a point on $\partial\Omega$ such that $\Omega$ is not convex locally. But I have no idea how to write it clearly. Thanks to your help.
 A: Let $B_r(x) \subset \mathbb R^n$ denote the open ball with center $x \in \mathbb R^n$ and radius $r > 0$. For $x,y \in \mathbb R^n$ and $t \in  \mathbb R$ define $L(x,y;t) = (1-t)x + ty$ and $L(x,y) = \{ L(x,y;t) \mid  t \in [0,1] \}$ = line segment from $x$ to $y$.
A polygonal chain in $\mathbb  R^n$ is a set of the form
$$P(x_1,\ldots,x_n) = \bigcup_{i=1}^{n-1} L(x_i,x_{i+1})$$
The $x_i$ are called its vertices. We also say that $P(x_1,\ldots,x_n)$ is polygonal chain from $x_1$ to $x_n$.
Lemma 1. If $\Omega \subset \mathbb R^n$ is open and connected, then for any two $x,y \in \Omega$ there exists a polygonal chain $P \subset \Omega$ from $x$ to $y$.
Proof. Let $x \in \Omega$ and let $U$ be the set of points $y \in \Omega$ which admit a polygonal chain $P \subset \Omega$ from $x$ to $y$. Then $U$ is open: Let $y \in U$ and $P(x_1,\ldots, x_n) \subset \Omega$ be a polygonal chain from $x$ to $y$. We have $B_r(y) \subset \Omega$ for some $r > 0$, thus for each $y' \in B_r(y)$ the set $P(x_1,\ldots, x_n,y') \subset \Omega$ is a polygonal chain from $x$ to $y'$. Also the complement $V = \Omega \setminus U$ is open: For $y \in V$ we have $B_r(y) \subset \Omega$ for some $r > 0$, and if $y' \in U$ for some $y' \in B_r(y)$, then there is a polygonal chain $P(x_1,\ldots, x_n) \subset \Omega$ from $x$ to $y'$, hence $P(x_1,\ldots, x_n,y) \subset \Omega$ is a polygonal chain from $x$ to $y$, a contradiction. The connectivity of $\Omega$ shows that $U = \Omega$.
Lemma 2. Let $\Omega \subset \mathbb R^n$ be regular (which means that it is open, connected and satisfies the local convexity property of the question) and let $P(x,y,z) \subset \Omega$ be a polygonal chain with three vertices. Then also line segment $L(x,z)$ is contained in $\Omega$.
Proof. Assume that $L(x,z)$ intersects the closed set $C = \mathbb R^n \setminus \Omega$. In particular it is impossible that  $y \in L$ and we conclude that $x, y, z$ lie in a (unique) two-dimensional affine plane $E \subset \mathbb R^n$.
For $t \in [0,1]$ let $T(x, t) \subset E$ denote the solid triangle with vertices $x, y, y_t =  L(y,z;t)$. For $t = 0$ it is degenerate to the line segment $L(x,y)$. The line segment $L(x,y_t)$ is an edge of $T(x,t)$ and we have $T(x,t) = \bigcup_{s \in [0,t]} L(x,y_s)$. Define
$$A = \{ t \in [0,1] \mid T(x, t) \subset \Omega \} , \tau = \sup A .$$
We have $0 \in A$, thus $\tau \in [0,1]$. We claim that $A$ is open in $[0,1]$. Let $t \in A$. Then $[0,t] \subset A$ since $T(x,s) \subset T(x,t)$ for $0 \le s \le t$. The line segment $L(x,y_t)$ has positive distance $d > 0$ from $C$. For suffienctly small $\epsilon > 0$ we see that for all $s \in (t - \epsilon, t + \epsilon)$ each point in $L(x,y_s)$ has distance $< d/2$ from $L(x,y_t)$. Hence $L(x,y_s)$ has positive distance from $C$ for $s \in (t - \epsilon, t + \epsilon)$ which implies that $L(x, y_s) \subset \Omega$ for $s \in (t - \epsilon, t + \epsilon)$. We conclude that $T(x,t') =  \bigcup_{s \in [0,t']} L(x,y_s) \subset \Omega$ for $t' \in [0,1] \cap (t - \epsilon,t + \epsilon)$.
By definition $[0,\tau) \subset A \subset [0,\tau]$. We claim that $\tau \notin A$, i.e. $A = [0,\tau)$. If $\tau = 1$ this is clear since $1 \notin A$ and follows from the fact that $A$ is open if $\tau < 1$.
This means that $\tau$ has the property $T'(x,\tau) =  T(x,\tau) \setminus L(x,y_\tau) \subset \Omega$ and $C_\tau = L(x,y_\tau) \cap C \ne \emptyset$. Therefore $C_\tau \subset \overline \Omega$, but $C_\tau \cap \Omega = \emptyset$. Now define
$$\sigma = \inf\{ s \in [0,1] \mid L(x,y_\tau;s) \in C_\tau\} .$$
Clearly $0 < \sigma < 1$ and $\xi = L(x,y_\tau;\sigma)$ is the point on $L(x,y_\tau) \cap C \subset \overline \Omega$ which has the smallest distance to $x$. Let $U$ be an  open neigborhood of $\xi$ such that $U' = U \cap \Omega$ is convex. There exists $\sigma' \in (0,\sigma)$ such that $\xi'  = L(x,y_\tau;\sigma') \in U'$. We find $r > 0$ such that $B_r(\xi') \subset U'$. The set $B_r(\xi')$ contains a point $\xi'' \in E \setminus T(x,\tau)$. We have $\xi'' \in U'$. The ray which starts at $\xi''$ and goes through $\xi$ contains a point $\eta \in T'(x,\tau) \cap U'$. Since $U'$ is convex, we get $\xi \in L(\xi'',\eta) \subset U' \subset \Omega$, a contradiction since $\xi \in C_r \subset C = \mathbb R^n \setminus \Omega$.
Corollary: Each regular $\Omega \subset \mathbb R^n$ is convex.
Proof: Let $x,y \in \Omega$. Let $P(x_1,\ldots, x_n) \subset \Omega$ be a polygonal chain from $x$ to $y$ with $n$ minimal. Assume $n > 2$. Then Lemma 2 gives us a polygonal chain in $\Omega$ from $x$ to $y$ with $n-1$ vertices, a contradiction. Thus $n =2$, i.e. $L(x,y) \subset \Omega$.
A: I will follow the proof of the theorem from the answer in this post. The accepted answer in the aforementioned post is much cleaner but relies on some ideas from abstract functional analysis to generalize the result to arbitrary topological vector spaces, which personally I find thoroughly depressing. The proof I present is more on the concrete, hard analysis side.
It suffices to show the result for bounded $\Omega$, since convex sets are closed under taking ascending chains (just intersect $\Omega$ with open balls of increasing radii). By the Lebesgue covering lemma, there exists $\epsilon > 0$ such that for every $x \in \overline\Omega$, there exists $y \in \overline\Omega$ such that $B_\epsilon (x) \subseteq U_y$, so in particular $B_\epsilon (x) \cap \Omega$ is convex. In other words, $\Omega$ is uniformly locally convex.
Recall open connected implies path connected and $\overline{\Omega \cap U_x}$ is convex, so $\overline \Omega$ is path connected (this is not true in general!). The path length function, given by
$$\text{length}(\gamma) = \sup_{\Pi} \sum_{i} |\gamma(t_i) - \gamma(t_{i + 1})|$$
where the supremum is taken over partitions $\Pi$ of whatever the domain of a continuous path $\gamma: [a, b] \to \overline \Omega$, is lower semicontinuous as the supremum of continuous functions.
Fix $x, y \in \overline\Omega$, then arguing by Arzela-Ascoli and arclength parametrization (cf. for example this post), there exists a path $\gamma : [0, 1] \to \overline\Omega$ of minimum length between $x$ and $y$. We claim that $\gamma$ is a straight line, which would prove convexity of $\overline\Omega$ and therefore its interior $\Omega$.
By uniform continuity, we can find $n \in \mathbb N$ sufficiently large such that
$$ |\gamma(i/2^n) - \gamma((i + 1)/2^n)| < \epsilon $$
for all $i = 0, \dots, 2^n - 1$. For brevity, denote $a_i = \gamma(i/2^n)$. We have $a_i \in \overline\Omega$ and $a_{i - 1} , a_{i + 1} \in B_\epsilon (a_i)$. Since $\overline \Omega \cap B_\epsilon (a_i)$ is convex (follow the usual proof of showing convex sets are closed under closure), there exists a line between $a_{i - 1}, a_{i + 1}$ in $\overline \Omega \cap B_\epsilon (a_i)$, call it $\Gamma_i$. But then we can parametrize
$$ \gamma([0, (i - 1)/2^n]) \cup \Gamma_i \cup \gamma([(i + 1)/2^n, 1]) $$
as a path from $x$ to $y$ in $\overline\Omega$ which has length
$$ \text{length} \ \gamma([0, (i - 1)/2^n]) + |a_{i + 1} - a_{i - 1}| + \text{length} \ \gamma([(i + 1)/2^n, 1]) \geq \text{length} (\gamma). $$
Rearranging,
$$ |a_{i + 1} - a_{i - 1}| \geq \text{length} \ \gamma([(i - 1)/2^n, (i + 1)/2^n]). $$
But of course, straight lines are the unique shortest paths in Euclidean space, so this implies the section of the path $\gamma([(i - 1)/2^n, (i + 1)/2^n])$ is straight. Arguing for each $i$ tells us $\gamma$ is in fact a straight line, completing the proof.
Edit (minor technicality): it is not entirely obvious that a rectifiable (i.e. finite length) path exists between any two points, but this follows from the uniform continuity + local convexity argument from the final part of the proof, which for arbitrary paths allows us to construct piecewise linear (often called "polygonal") paths in $\overline\Omega$ between two points, which clearly has finite length. The existence of this construction is often times convenient to use in complex analysis, and of course in this scenario.
